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.
[clang] fix sema init crashing on initialization sequences (llvm#98102)
We ran into a FE crash and root caused to `ER.get()` on line 5584 here being nullptr. I think this is a result of not checking if ER here is invalid. Example of crash-on-valid C++ https://gist.github.com/yuxuanchen1997/576dce964666f0f8713fccacf5847138 Note that this crash happens only with `-std=c++20`.
- Loading branch information
1 parent
1f819f0
commit 6f13c71
Showing
3 changed files
with
39 additions
and
0 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
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,33 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s | ||
// expected-no-diagnostics | ||
|
||
template <bool v> | ||
struct BC { | ||
static constexpr bool value = v; | ||
}; | ||
|
||
template <typename T, typename Arg> | ||
struct Constructible : BC<__is_constructible(T, Arg)> {}; | ||
|
||
template <typename T> | ||
using Requires = T::value; | ||
|
||
template <typename T> | ||
struct optional { | ||
template <typename U, Requires<Constructible<T, U>> = true> | ||
optional(U) {} | ||
}; | ||
|
||
struct MO {}; | ||
struct S : MO {}; | ||
struct TB { | ||
TB(optional<S>) {} | ||
}; | ||
|
||
class TD : TB, MO { | ||
using TB::TB; | ||
}; | ||
|
||
void foo() { | ||
static_assert(Constructible<TD, TD>::value); | ||
} |