================
@@ -221,8 +221,13 @@ static const ValueDecl *getAsSimpleValueDeclRef(const 
ASTContext &Ctx,
 
   // We model class non-type template parameters as their template parameter
   // object declaration.
-  if (V.isStruct() || V.isUnion())
+  if (V.isStruct() || V.isUnion()) {
+    // Dependent types are not supposed to be described as
+    // TemplateParamObjectDecls.
+    if (T->isDependentType() || T->isInstantiationDependentType())
+      return nullptr;
----------------
zyn0217 wrote:

The only caller of `getAsSimpleValueDeclRef` is `TemplateArgument`'s 
constructor (for an NTTP establishment), where we basically try the following 
things in order, IIUC:
1) integral type
2) nullptrs
3) declarations (this is where we called `getAsSimpleValueDeclRef` and built up 
a `TemplateParamObjectDecl` if the function does return a value)

otherwise, a structural type.

https://github.com/llvm/llvm-project/blob/74ed79f7f123788d95f1552800e1af9ceaee4a08/clang/lib/AST/TemplateBase.cpp#L237-L249

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

Reply via email to