Debian Codegraph @

clang/test/SemaCXX/specialization-diagnose-crash.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only %s --std=c++17 -verify
2 // This is a reduction of GH57370 and GH58028, originally appearing
3 // in libstdc++'s variant code.
4
5 struct V1 {};
6 struct V2 : V1 {
7 int &a;
8 };
9
10 template <class T> using void_t = void;
11
12 template <class T> struct X { T x; };
13
14 template <class T1, class T2, class = void> struct Variant {
15 Variant() = delete; // expected-note {{deleted here}}
16 };
17
18 template <class T1, class T2>
19 struct Variant<T1, T2, void_t<decltype(X<T2>{T1()})>> {};
20
21 void f() {
22 Variant<V1, V1>();
23 Variant<V1, V2>(); // expected-error {{call to deleted constructor}}
24 }