Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/decltype78.C

raw
1 // PR c++/81339
2 // { dg-do compile { target c++11 } }
3
4 struct true_type { static const bool value = true; };
5 struct false_type { static const bool value = false; };
6
7 template <typename T>
8 struct IsDefaultConstructibleT
9 {
10 // using T here (instead of U) should be an error
11 template <typename U, typename = decltype(T())> // { dg-error "deleted" }
12 static true_type test(void*);
13
14 template <typename U>
15 static false_type test(...);
16
17 static constexpr bool value = decltype(test<T>(nullptr))::value;
18 };
19
20 struct S {
21 S() = delete;
22 };
23
24 static_assert( IsDefaultConstructibleT<S>::value, "" ); // { dg-error "assertion failed" }