================
@@ -7417,6 +7477,12 @@ ExprResult Sema::CheckTemplateArgument(NamedDecl *Param, 
QualType ParamType,
     if (Value.isAddrLabelDiff())
       return Diag(StartLoc, diag::err_non_type_template_arg_addr_label_diff);
 
+    if (ParamType->isRecordType() &&
+        !ParamType->isInstantiationDependentType() &&
----------------
zwuis wrote:

> So I'd expect we would create a `TemplateParamObjectDecl` with such a type, 
> and then later substitute that, producing another `TemplateParamObjectDecl`. 
> So any changes to the `Profile` function would not really be necessary, if I 
> haven't misunderstood anything.

I think this _is_ necessary.

```cpp
static void /*TemplateParamObjectDecl::*/Profile(FoldingSetNodeID &ID, QualType 
T, const APValue &V) {
  ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());
//                ^^^^^^^^^^^^^^^^
  V.Profile(ID);
}
```

https://github.com/llvm/llvm-project/blob/c3a0eb4b8f4f4b5c4b705c04bc3f16e4985ddbdf/clang/include/clang/AST/DeclTemplate.h#L3317-L3321

This is also why

> 2. When checking template arguments of a non-dependent template id, we still 
> use that `TemplateParamObjectDecl` from the cache map.

https://github.com/llvm/llvm-project/pull/193754
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to