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
5 changes: 4 additions & 1 deletion clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,10 @@ QualType Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI,
// - an identifier associated by name lookup with a non-type
// template-parameter declared with a type that contains a
// placeholder type (7.1.7.4),
TSI = SubstAutoTypeSourceInfoDependent(TSI);
TypeSourceInfo *NewTSI = SubstAutoTypeSourceInfoDependent(TSI);
if (!NewTSI)
return QualType();
TSI = NewTSI;
}

return CheckNonTypeTemplateParameterType(TSI->getType(), Loc);
Expand Down
5 changes: 5 additions & 0 deletions clang/test/SemaTemplate/deduction-crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,8 @@ namespace PR51872_part1 {
// expected-error@-1 {{no viable constructor or deduction guide for deduction of template arguments of 'T1'}}
// expected-note@-7 {{candidate template ignored: could not match 'PR51872_part1::T1<value-parameter-0-0>' against 'int'}}
}

namespace GH177545 {
template<decltype(auto)()() volatile throw() -> char> // expected-error {{'decltype(auto)' can only be used as a return type in a function declaration}}
struct T2; // expected-error@-1 {{function cannot return function type 'auto () volatile throw() -> decltype(auto)'}}
}