forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Concepts] Fix a deserialization crash.
`TemplateTypeParmDecl::hasTypeConstraint` is not a safe guard for checking `TemplateTypeParmDecl::getTypeConstraint()` result is null. in somecases (e.g. implicit deduction guide templates synthesized from the constructor, immediately-declared constraint is not formed because of an error), hasTypeConstraint returns false, and getTypeConstraint returns a nullptr. Fix https://bugs.llvm.org/show_bug.cgi?id=46790 Differential Revision: https://reviews.llvm.org/D84455
- Loading branch information
Showing
2 changed files
with
34 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t | ||
// RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s | ||
|
||
// expected-no-diagnostics | ||
|
||
#ifndef HEADER | ||
#define HEADER | ||
|
||
template <typename T, typename U> | ||
concept not_same_as = true; | ||
|
||
template <int Kind> | ||
struct subrange { | ||
template <not_same_as<int> R> | ||
subrange(R) requires(Kind == 0); | ||
|
||
template <not_same_as<int> R> | ||
subrange(R) requires(Kind != 0); | ||
}; | ||
|
||
template <typename R> | ||
subrange(R) -> subrange<42>; | ||
|
||
int main() { | ||
int c; | ||
subrange s(c); | ||
} | ||
|
||
#endif |