[PATCH] D105478: [clang] Make CXXRecrdDecl invalid if it contains any undeduced fields.

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 2 09:32:28 PDT 2021


adamcz added inline comments.


================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:2987
+        if (ThisDecl)
+          ThisDecl->setInvalidDecl();
         SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
----------------
hokein wrote:
> it seems to me calling `Sema::ActOnInitializerError(ThisDecl)` is a better fit, rather than invalidating the decl once the initializer is failed to parse, for example `static const int Member = ;` we want to keep the decl valid.
Amusingly, this change led me to discover https://bugs.llvm.org/show_bug.cgi?id=36064, which seems like the same issue, only solved for a very specific example. I had to update the test for that, since now we solve it more generically and thus error messages are different.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105478/new/

https://reviews.llvm.org/D105478



More information about the cfe-commits mailing list