================
@@ -14622,7 +14622,8 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl 
*var) {
       Diag(var->getLocation(), diag::err_thread_nontrivial_dtor);
       if (getLangOpts().CPlusPlus11)
         Diag(var->getLocation(), diag::note_use_thread_local);
-    } else if (getLangOpts().CPlusPlus && var->hasInit()) {
+    } else if (getLangOpts().CPlusPlus && var->hasInit() &&
+               !var->getType()->isDependentType()) {
----------------
erichkeane wrote:

We should be doing this check in `checkConstInit`, AND we shouldn't be doing it 
on the type of the variable, we should be doing it on the dependency of the 
init-expr.

This patch doesn't fix:

```
template<typename T>
void foo() {
 static __thread int *my_thing = T{};
```

So I think line 14611 should be:

`if (var->getInit()->isInstantiationDependent()) return true;`, at least for 
here.  THOUGH looking at later uses of `checkConstInit`, I'm not sure what the 
fallotu of that would be below.


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

Reply via email to