[clang] [Clang] Fixed a crash when instantiating an invalid out-of-line static data member definition in a local class (PR #196772)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 10 06:22:42 PDT 2026
TPPPP72 wrote:
> > I think this is a timing issue: when parsing function f, A only reports an error but doesn't mark it as invalid.
>
> This is not a timing issue, but where the problem happens. You should invalidate the decl as soon as it gets diagnosed, rather than deferring them to the instantiation.
I don't think avoiding instantiation is feasible, as clang currently doesn't process `VarDecl`.
[https://godbolt.org/z/e5WWMoqEh](https://godbolt.org/z/e5WWMoqEh)
Not instantiating the template doesn't report a `VarDecl` error, and node `b` is valid. If we directly mark the entire `CXXRecordDecl` as invalid, I believe the reverted PR has already proven it's not feasible.
https://github.com/llvm/llvm-project/pull/196772
More information about the cfe-commits
mailing list