diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13199,7 +13199,6 @@ if (Type->isReferenceType()) { Diag(Var->getLocation(), diag::err_reference_var_requires_init) << Var << SourceRange(Var->getLocation(), Var->getLocation()); - Var->setInvalidDecl(); return; } diff --git a/clang/test/AST/ast-dump-invalid-initialized.cpp b/clang/test/AST/ast-dump-invalid-initialized.cpp --- a/clang/test/AST/ast-dump-invalid-initialized.cpp +++ b/clang/test/AST/ast-dump-invalid-initialized.cpp @@ -12,10 +12,10 @@ const A a2; // CHECK: `-VarDecl {{.*}} a3 'A' A a3 = garbage(); + // CHECK: `-VarDecl {{.*}} a4 'const A &' + const A& a4; - // CHECK: `-VarDecl {{.*}} invalid b1 'const A &' - const A& b1; // CHECK: `-VarDecl {{.*}} invalid b2 'ForwardDecl' ForwardDecl b2; // CHECK: `-VarDecl {{.*}} invalid b3 'auto'