Skip to content
Merged
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
4 changes: 3 additions & 1 deletion clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8968,8 +8968,10 @@ Sema::ActOnFinishConceptDefinition(Scope *S, ConceptDecl *C,
Expr *ConstraintExpr,
const ParsedAttributesView &Attrs) {
assert(!C->hasDefinition() && "Concept already defined");
if (DiagnoseUnexpandedParameterPack(ConstraintExpr))
if (DiagnoseUnexpandedParameterPack(ConstraintExpr)) {
C->setInvalidDecl();
return nullptr;
}
C->setDefinition(ConstraintExpr);
ProcessDeclAttributeList(S, C, Attrs);

Expand Down
14 changes: 14 additions & 0 deletions clang/test/SemaCXX/concept-crash-on-diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,17 @@ concept atomicish = requires() {
};
atomicish<int> f(); // expected-error {{expected 'auto' or 'decltype(auto)' after concept name}}
} // namespace GH138820

namespace GH138823 {
template <typename T> void foo();
template <class... Ts>
concept ConceptA = requires { foo<Ts>(); };
// expected-error@-1 {{expression contains unexpanded parameter pack 'Ts'}}

template <class>
concept ConceptB = ConceptA<int>;

template <ConceptB Foo> void bar(Foo);

void test() { bar(1); }
}
Loading