Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5107,12 +5107,9 @@ bool TreeTransform<Derived>::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;

Expand Down Expand Up @@ -7220,7 +7217,10 @@ QualType TreeTransform<Derived>::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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to transform types even if they are only instantiation dependent.

? getDerived().TransformType(T->getReplacementType())
: T->getReplacementType();
if (Replacement.isNull())
return QualType();

Expand Down
34 changes: 34 additions & 0 deletions clang/test/SemaTemplate/concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,3 +1505,37 @@ namespace GH162770 {
template<typename... Ts> auto comma = (..., Ts());
auto b = comma<check<e{}>>;
} // namespace GH162770

namespace GH102353 {

template <typename _Tp, typename>
concept same_as = true;

template <typename _Lhs>
concept assignable_from = requires {
{ 0 } -> same_as<_Lhs>;
};

template <typename _Iter>
struct span {
_Iter iter;
};

template <assignable_from _Iter>
span(_Iter) -> span<_Iter>;

template <class T, T value>
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<int, 42>(); // expected-note {{requested here}}
}

}