Files
clang-p2996/clang/test/SemaCXX/pr98102.cpp
Yuxuan Chen 6f13c71d31 [clang] fix sema init crashing on initialization sequences (#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`.
2024-07-10 11:24:23 -07:00

34 lines
591 B
C++

// 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);
}