[clang] [C++] Fix a crash with __thread and dependent types (PR #140542)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 07:23:38 PDT 2025
================
@@ -14608,6 +14608,10 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
std::optional<bool> CacheHasConstInit;
const Expr *CacheCulprit = nullptr;
auto checkConstInit = [&]() mutable {
+ const Expr *Init = var->getInit();
+ if (Init->isInstantiationDependent())
----------------
AaronBallman wrote:
That's the case I think isn't problematic, because of the predicate:
```
if ((getLangOpts().CPlusPlus || (getLangOpts().C23 && var->isConstexpr())) &&
!type->isDependentType() && Init && !Init->isValueDependent() &&
(GlobalStorage || var->isConstexpr() ||
var->mightBeUsableInConstantExpressions(Context))) {
```
https://github.com/llvm/llvm-project/pull/140542
More information about the cfe-commits
mailing list