transform.
Also diagnose typos in the initializer of an invalid C++ declaration.
Both issues were hit using the same line of test code, depending on
whether the code was treated as C or C++.
Fixes PR22092.
llvm-svn: 225389
bool DirectInit, bool TypeMayContainAuto) {
// If there is no declaration, there was an error parsing it. Just ignore
// the initializer.
- if (!RealDecl || RealDecl->isInvalidDecl())
+ if (!RealDecl || RealDecl->isInvalidDecl()) {
+ CorrectDelayedTyposInExpr(Init);
return;
+ }
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(RealDecl)) {
// With declarators parsed the way they are, the parser cannot
ExprResult TransformLambdaExpr(LambdaExpr *E) { return Owned(E); }
+ ExprResult TransformOpaqueValueExpr(OpaqueValueExpr *E) {
+ if (Expr *SE = E->getSourceExpr())
+ return TransformExpr(SE);
+ return BaseTransform::TransformOpaqueValueExpr(E);
+ }
+
ExprResult Transform(Expr *E) {
ExprResult Res;
while (true) {
float x;
x = (float)arst; // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
}
+
+a = b ? : 0; // expected-warning {{type specifier missing, defaults to 'int'}} \
+ // expected-error {{use of undeclared identifier 'b'}}
int blue; // expected-note {{'blue' declared here}}
__typeof blur y; // expected-error {{use of undeclared identifier 'blur'; did you mean 'blue'?}}
}
+
+namespace PR22092 {
+a = b ? : 0; // expected-error {{C++ requires a type specifier for all declarations}} \
+ // expected-error-re {{use of undeclared identifier 'b'{{$}}}}
+}