annotate gcc/testsuite/g++.dg/cpp0x/trailing10.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/65133
kono
parents:
diff changeset
2 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 template<bool, typename Tp = void>
kono
parents:
diff changeset
5 struct enable_if { };
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 template<typename Tp>
kono
parents:
diff changeset
8 struct enable_if<true, Tp> { typedef Tp type; };
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 template <int I>
kono
parents:
diff changeset
11 struct count
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 using type = typename count<I-1>::type;
kono
parents:
diff changeset
14 };
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 template <>
kono
parents:
diff changeset
17 struct count<0>
kono
parents:
diff changeset
18 {
kono
parents:
diff changeset
19 using type = void;
kono
parents:
diff changeset
20 };
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 template <int I>
kono
parents:
diff changeset
23 auto foo(typename enable_if<(I>=0)>::type *
kono
parents:
diff changeset
24 = nullptr) -> typename count<I>::type { }
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 template <int I>
kono
parents:
diff changeset
27 void foo(typename enable_if<(I<0)>::type * = nullptr) { }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 int main()
kono
parents:
diff changeset
30 {
kono
parents:
diff changeset
31 foo<2>();
kono
parents:
diff changeset
32 foo<-1>();
kono
parents:
diff changeset
33 }