]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/sfinae54.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / sfinae54.C
CommitLineData
ac1a984a
PC
1// PR c++/63723
2// { dg-do compile { target c++11 } }
3
4template<typename Tp> Tp declval();
5
6template<typename Tp, Tp v>
7struct integral_constant
8{
9 static constexpr Tp value = v;
10 typedef Tp value_type;
11 typedef integral_constant<Tp, v> type;
12 constexpr operator value_type() const { return value; }
13};
14
15typedef integral_constant<bool, true> true_type;
16typedef integral_constant<bool, false> false_type;
17
18template <typename From, typename To>
19class is_list_convertible_helper
20{
21 template <typename To2>
22 static void requires_conversion(To2 t);
23
24 template <typename From2, typename To2,
25 typename = decltype(requires_conversion<To2>({declval<From2>()}))>
26 static true_type helper(int);
27
28 template <typename From2, typename To2>
29 static false_type helper(...);
30
31public:
32 using type = decltype(helper<From, To>(0));
33};
34
35template <typename From, typename To>
36class is_list_convertible
37 : public is_list_convertible_helper<From, To>::type
38{ };
39
40static_assert(!is_list_convertible<double, int>::value,
41 "double -> int is narrowing!");
This page took 3.67233 seconds and 5 git commands to generate.