-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sema] Fix assertion error in Sema::FindInstantiatedDecl (#96509)
...when looking for a template instantiation with a non-type parameter of unknown type and with a default value. This can happen when a template non-type parameter has a broken expression that gets replaced by a `RecoveryExpr`.
- Loading branch information
1 parent
f0617d2
commit e5df657
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
clang/test/SemaCXX/instantiate-template-broken-nontype-default.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s | ||
|
||
constexpr Missing a = 0; // expected-error {{unknown type name 'Missing'}} | ||
|
||
template < typename T, Missing b = a> // expected-error {{unknown type name 'Missing'}} | ||
class Klass { // expected-note {{candidate template ignored: could not match 'Klass<T, b>' against 'int'}} \ | ||
expected-note {{implicit deduction guide declared as 'template <typename T, int b = <recovery-expr>()> Klass(Klass<T, b>) -> Klass<T, b>'}} | ||
Klass(T); // expected-note {{candidate template ignored: substitution failure [with T = int, b = <recovery-expr>()]}} \ | ||
expected-note {{implicit deduction guide declared as 'template <typename T, int b = <recovery-expr>()> Klass(T) -> Klass<T, b>'}} | ||
}; | ||
|
||
Klass foo{5}; // no-crash \ | ||
expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'Klass'}} | ||
|