You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Clang][Sema] Do not perform error recovery for invalid member using-declaration in C++20+ mode (#147003)
Previously, Clang tried to perform error recovery for invalid member
using-declaration whose nested-name-specifier refers to its own class in
C++20+ mode, which causes crash.
```cpp
template <typename...> struct V {};
struct S : V<> {
using S::V; // error recovery here
V<> v; // crash
};
```
This PR disables the error recovery to fix the crash.
Fixes#63254
return E::X; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
128
+
return E::X; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
122
129
}
123
130
}
124
131
}
@@ -170,8 +177,9 @@ void ::global_func2(int) { } // expected-warning{{extra qualification on member
170
177
171
178
voidN::f() { } // okay
172
179
173
-
structY; // expected-note{{forward declaration of 'Y'}}
174
-
Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}}
180
+
// FIXME (GH147000): duplicate diagnostics
181
+
structY; // expected-note{{forward declaration of 'Y'}} since-cxx20-note{{forward declaration of 'Y'}}
182
+
Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} since-cxx20-error{{incomplete type 'Y' named in nested name specifier}}
175
183
176
184
namespacePR25156 {
177
185
structY; // expected-note{{forward declaration of 'PR25156::Y'}}
@@ -189,7 +197,9 @@ bool (foo_S::value);
189
197
190
198
191
199
namespacesomens {
192
-
structa { }; // expected-note{{candidate constructor (the implicit copy constructor)}}
200
+
structa { };
201
+
// expected-note@-1 {{candidate constructor (the implicit copy constructor)}}
202
+
// since-cxx11-note@-2 {{candidate constructor (the implicit move constructor)}}
193
203
}
194
204
195
205
template <typename T>
@@ -432,20 +442,20 @@ namespace PR16951 {
432
442
};
433
443
}
434
444
435
-
int x1 = ns::an_enumeration::ENUMERATOR; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
445
+
int x1 = ns::an_enumeration::ENUMERATOR; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
436
446
437
-
int x2 = ns::an_enumeration::ENUMERATOR::vvv; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
447
+
int x2 = ns::an_enumeration::ENUMERATOR::vvv; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
438
448
// expected-error{{'ENUMERATOR' is not a class, namespace, or enumeration}} \
439
449
440
-
int x3 = ns::an_enumeration::X; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
450
+
int x3 = ns::an_enumeration::X; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
441
451
// expected-error{{no member named 'X'}}
442
452
443
453
enum enumerator_2 {
444
454
ENUMERATOR_2
445
455
};
446
456
447
-
int x4 = enumerator_2::ENUMERATOR_2; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
448
-
int x5 = enumerator_2::X2; //expected-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
457
+
int x4 = enumerator_2::ENUMERATOR_2; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}}
458
+
int x5 = enumerator_2::X2; //cxx98-warning{{use of enumeration in a nested name specifier is a C++11 extension}} \
449
459
// expected-error{{no member named 'X2' in 'PR16951::enumerator_2'}} \
450
460
// expected-error{{cannot initialize a variable of type 'int' with an lvalue of type 'int (*)()'}}
0 commit comments