[clang] [clang][bytecode] fix assertion failure on invalid init list (GH175432) (PR #180261)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 05:50:12 PST 2026
Serosh-commits wrote:
> Yeah sorry but none of this makes sense to me. None of the ast nodes are marked has having errors, so adding those `containsErrors()` checks makes no difference. All those checks in the `Pointer` accessors make no sense since that state should never happen.
>
> ```c++
> constexpr const int *foo[][2];
> ```
>
> this declaration gets marked as invalid, so why not
>
> ```c++
> constexpr const int *foo[][2] = { {nullptr, int}, };
> ```
>
> ?
@tbaederr Sorry for the previous approach i realize now that adding checks in the interpreter was just masking the issue
I've been thinking about it and realized that while ActOnUninitializedDecl already marks constexpr variables as invalid,
ActOnInitializerError doesn't do the same when an initializer simply fails to parse. I think this gap is why the interpreter s till tries to evaluate them
Am I correct that we should just add VD->isConstexpr() to ActOnInitializerError to stay consistent, or is there a better way to handle this in Sema?
if (VD->getType()->isUndeducedType() || VD->isConstexpr()) {
D->setInvalidDecl();
return;
}
https://github.com/llvm/llvm-project/pull/180261
More information about the cfe-commits
mailing list