================
@@ -6828,7 +6828,7 @@ static bool MayBeFunctionType(const ASTContext &Context,
const Expr *E) {
T == Context.BuiltinFnTy || T == Context.OverloadTy ||
T->isFunctionType() || T->isFunctionReferenceType() ||
T->isMemberFunctionPointerType() || T->isFunctionPointerType() ||
- T->isBlockPointerType() || T->isRecordType())
+ T->isBlockPointerType() || T->isRecordType() || T->isUndeducedType())
----------------
Waffl3x wrote:
tl;dr undeduced types aren't leaking out, it's just a quirk of how
SubstNonTypeTemplateParmPackExpr is built.
I got curious and investigated this, it looks like
SubstNonTypeTemplateParmPackExpr is just always built with the declared type of
the constant template parameter.
https://github.com/llvm/llvm-project/blob/2078da43e25a4623cab2d0d60decddf709aaea28/clang/lib/Sema/SemaTemplateInstantiate.cpp#L2235-L2247
And while slightly different now...
https://github.com/llvm/llvm-project/blob/2a8e0e1abbdc558f3a4b43d5a9432c07b5d01387/clang/lib/Sema/SemaTemplateInstantiate.cpp#L2189-L2215
...it doesn't seem to change the outcome.
So it's relying on a quirk of SubstNonTypeTemplateParmPackExpr that won't
reasonably change.
https://clang.llvm.org/doxygen/classclang_1_1SubstNonTypeTemplateParmPackExpr.html
> When a pack expansion in the source code contains multiple parameter packs
> and those parameter packs correspond to different levels of template
> parameter lists, this node is used to represent a non-type template parameter
> pack from an outer level,...
https://clang.llvm.org/doxygen/ExprCXX_8cpp_source.html#l01773
```
setDependence(ExprDependence::TypeValueInstantiation |
ExprDependence::UnexpandedPack);
```
With that said, it looks like
"E->[containsUnexpandedParameterPack](https://clang.llvm.org/doxygen/classclang_1_1Expr.html#a45c0f5a000bc434250cb5338a536e187)()"
conveys the intent more accurately, and effectively relies on the same quirk.
On the other hand, if TemplateInstantiator::TransformTemplateParmRefExpr gets a
QoI change to store the deduced type when every element is the same, using
containsUnexpandedParameterPack will suppress valid diagnostics.
https://github.com/llvm/llvm-project/pull/208007
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits