Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / template / sfinae16.C
blob28a06d280d33c87767d79c14b2d2429d4603e744
1 // PR c++/41927
2 // { dg-options "-std=c++0x -Wall" }
4 // We were getting a spurious ||/&& warning about the enable_if with the
5 // source position of d1.
7 template<typename Tp>
8   struct is_int
9   { static const bool value = true; };
11 template<bool, typename Tp = void>
12   struct enable_if
13   { };
15 template<typename Tp>
16   struct enable_if<true, Tp>
17   { typedef Tp type; };
19 template<typename Rep>
20   struct duration
21   {
22     duration() { }
24     template<typename Rep2, typename = typename
25              enable_if<false || (true && is_int<Rep2>::value)>::type>
26     duration(const duration<Rep2>&) { }
27   };
29 int main()
31   duration<int> d0;
32   duration<int> d1 = d0;        // { dg-warning "set but not used" }