================
@@ -13435,16 +13435,18 @@ void Sema::checkNonTrivialCUnion(QualType QT, 
SourceLocation Loc,
 void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
   // If there is no declaration, there was an error parsing it.  Just ignore
   // the initializer.
-  if (!RealDecl || RealDecl->isInvalidDecl()) {
+  if (!RealDecl) {
     CorrectDelayedTyposInExpr(Init, dyn_cast_or_null<VarDecl>(RealDecl));
     return;
   }
 
   if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(RealDecl)) {
----------------
HighCommander4 wrote:

Actually, that's not quite right, either. There is a `return;` that we want to 
take for any method, and a diagnostic for the `!Method->isInvalidDecl()` case. 
We therefore do need two nested `if`s.

https://github.com/llvm/llvm-project/pull/88645
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to