diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 940324bbc5e4d..bd21f35178b3b 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -5107,12 +5107,9 @@ bool TreeTransform::TransformTemplateArguments( TemplateArgument::pack_iterator> PackLocIterator; - TemplateArgumentListInfo *PackOutput = &Outputs; - TemplateArgumentListInfo New; - if (TransformTemplateArguments( PackLocIterator(*this, In.getArgument().pack_begin()), - PackLocIterator(*this, In.getArgument().pack_end()), *PackOutput, + PackLocIterator(*this, In.getArgument().pack_end()), Outputs, Uneval)) return true; @@ -7220,7 +7217,10 @@ QualType TreeTransform::TransformSubstTemplateTypeParmType( // that needs to be transformed. This only tends to occur with default // template arguments of template template parameters. TemporaryBase Rebase(*this, TL.getNameLoc(), DeclarationName()); - QualType Replacement = getDerived().TransformType(T->getReplacementType()); + QualType Replacement = + T->getReplacementType()->isDependentType() + ? getDerived().TransformType(T->getReplacementType()) + : T->getReplacementType(); if (Replacement.isNull()) return QualType(); diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 3fbe7c0ac650f..d68b8fa432453 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1505,3 +1505,37 @@ namespace GH162770 { template auto comma = (..., Ts()); auto b = comma>; } // namespace GH162770 + +namespace GH102353 { + +template +concept same_as = true; + +template +concept assignable_from = requires { + { 0 } -> same_as<_Lhs>; +}; + +template +struct span { + _Iter iter; +}; + +template +span(_Iter) -> span<_Iter>; + +template +void doHQScale() { + int srcWidth = value; // expected-note 2{{declared here}} + // We shouldn't crash with VLA types, which would appear when + // substituting constraint expressions, as they are part of the sugars now. + int edgeBuf_storage[srcWidth]; // expected-warning 2{{variable length arrays}} \ + // expected-note 2{{read of non-const variable 'srcWidth'}} + span s(edgeBuf_storage); +} + +void foo() { + doHQScale(); // expected-note {{requested here}} +} + +}