File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
clang/test/CXX/class/class.compare/class.compare.default Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,22 @@ namespace std {
18
18
19
19
namespace N {
20
20
struct A {
21
- friend constexpr std::strong_ordering operator <=>(const A&, const A&) = default ;
21
+ friend constexpr std::strong_ordering operator <=>(const A&, const A&) = default ; // expected-note 2{{declared here}}
22
22
};
23
23
24
- constexpr bool (*test_a_not_found)(const A&, const A&) = &operator==; // expected-error {{undeclared}}
24
+ constexpr std::strong_ordering (*test_a_threeway_not_found)(const A&, const A&) = &operator<=>; // expected-error {{undeclared}}
25
+
26
+ constexpr std::strong_ordering operator <=>(const A&, const A&) noexcept ;
27
+ constexpr std::strong_ordering (*test_a_threeway)(const A&, const A&) = &operator<=>;
28
+ static_assert ((*test_a_threeway)(A(), A())); // expected-error {{static assertion expression is not an integral constant expression}}
29
+ // expected-note@-1 {{undefined function 'operator<=>' cannot be used in a constant expression}}
30
+
31
+ constexpr bool (*test_a_equal_not_found)(const A&, const A&) = &operator==; // expected-error {{undeclared}}
25
32
26
33
constexpr bool operator ==(const A&, const A&) noexcept ;
27
- constexpr bool (*test_a)(const A&, const A&) noexcept = &operator==;
28
- static_assert ((*test_a)(A(), A()));
34
+ constexpr bool (*test_a_equal)(const A&, const A&) noexcept = &operator==;
35
+ static_assert ((*test_a_equal)(A(), A())); // expected-error {{static assertion expression is not an integral constant expression}}
36
+ // expected-note@-1 {{undefined function 'operator==' cannot be used in a constant expression}}
29
37
}
30
38
31
39
struct B1 {
You can’t perform that action at this time.
0 commit comments