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