1
- // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
1
+ // RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx23 -std=c++11 %s
2
+ // RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx23 -std=c++23 %s
3
+
2
4
class X { };
3
5
4
6
X operator +(X, X);
@@ -33,7 +35,9 @@ struct A {
33
35
34
36
A make_A ();
35
37
36
- bool operator ==(A&, Z&); // expected-note 3{{candidate function}}
38
+ bool operator ==(A&, Z&); // expected-note 3{{candidate function}} \
39
+ // cxx23-note 2{{candidate function}}
40
+
37
41
38
42
void h (A a, const A ac, Z z) {
39
43
make_A () == z; // expected-warning{{equality comparison result unused}}
@@ -68,7 +72,9 @@ struct E2 {
68
72
};
69
73
70
74
// C++ [over.match.oper]p3 - enum restriction.
71
- float & operator ==(E1 , E2 ); // expected-note{{candidate function}}
75
+ float & operator ==(E1 , E2 ); // expected-note{{candidate function}} \
76
+ // cxx23-note{{candidate function}}
77
+
72
78
73
79
void enum_test (Enum1 enum1, Enum2 enum2, E1 e1 , E2 e2 , Enum1 next_enum1) {
74
80
float &f1 = (e1 == e2 );
@@ -86,7 +92,8 @@ class pr5244_foo
86
92
};
87
93
88
94
bool operator ==(const pr5244_foo& s1, const pr5244_foo& s2); // expected-note{{candidate function}}
89
- bool operator ==(char c, const pr5244_foo& s); // expected-note{{candidate function}}
95
+ bool operator ==(char c, const pr5244_foo& s); // expected-note{{candidate function}} \
96
+ // cxx23-note{{candidate function}}
90
97
91
98
enum pr5244_bar
92
99
{
@@ -130,7 +137,7 @@ struct SmartPtr {
130
137
};
131
138
132
139
void test_smartptr (SmartPtr ptr, const SmartPtr cptr,
133
- const volatile SmartPtr cvptr) {
140
+ const volatile SmartPtr cvptr) { // cxx23-warning {{volatile-qualified parameter type 'const volatile SmartPtr' is deprecated}}
134
141
int &ir = *ptr;
135
142
long &lr = *cptr;
136
143
long &lr2 = *cvptr;
@@ -598,3 +605,43 @@ namespace B {
598
605
}
599
606
void g (B::X x) { A::f (x); }
600
607
}
608
+
609
+ namespace GH78314 {
610
+
611
+ class a {
612
+ public:
613
+ void operator --() = delete ; // expected-note {{candidate function has been explicitly deleted}} \
614
+ // expected-note {{candidate function not viable: requires 0 arguments, but 1 was provided}}
615
+ void operator --(int ) = delete ; // expected-note {{candidate function has been explicitly deleted}} \
616
+ // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}}
617
+ };
618
+
619
+ class c {
620
+ void operator --(this c) = delete ; // precxx23-error {{explicit object parameters are incompatible with C++ standards before C++2b}} \
621
+ // expected-note {{candidate function has been explicitly deleted}} \
622
+ // expected-note {{candidate function not viable: requires 0 non-object arguments, but 1 was provided}}
623
+ void operator --(this c, int ) = delete ; // precxx23-error {{explicit object parameters are incompatible with C++ standards before C++2b}} \
624
+ // expected-note {{candidate function has been explicitly deleted}} \
625
+ // expected-note {{candidate function not viable: requires 1 non-object argument, but 0 were provided}}
626
+ };
627
+
628
+ void foo () {
629
+ a aa;
630
+ --aa; // expected-error {{overload resolution selected deleted operator '--'}}
631
+ aa--; // expected-error {{overload resolution selected deleted operator '--'}}
632
+
633
+ c cc;
634
+ --cc; // expected-error {{overload resolution selected deleted operator '--'}}
635
+ cc--; // expected-error {{overload resolution selected deleted operator '--'}}
636
+ }
637
+
638
+ class b {
639
+ void operator ++() = delete ; // expected-note {{candidate function has been explicitly deleted}}
640
+ template <class > void operator ++(int ) { // expected-note {{function template not viable: requires 1 argument, but 0 were provided}}
641
+ b bb;
642
+ ++bb; // expected-error {{overload resolution selected deleted operator '++'}}
643
+ }
644
+ };
645
+
646
+
647
+ }
0 commit comments