111
|
1 // PR c++/45012
|
|
2
|
|
3 template <bool B, class T=void> struct enable_if;
|
|
4
|
|
5 template <class T>
|
|
6 struct enable_if<true,T>
|
|
7 {
|
|
8 typedef T type;
|
|
9 };
|
|
10
|
|
11 enum { RUNTIME = 0 };
|
|
12 // it compiles with the previous line commented out and the next commented in
|
|
13 // static const int RUNTIME=0;
|
|
14
|
|
15 template <class T, class U, class EN=void> struct foo;
|
|
16
|
|
17 template <template<int> class V, int M>
|
|
18 struct foo<V<M>,V<M>, typename enable_if<M==RUNTIME||M==2>::type> {};
|
|
19
|
|
20 template <template<int> class V1, template<int> class V2, int M>
|
|
21 struct foo<V1<M>,V2<M>, typename enable_if<M==RUNTIME||M==2>::type> {};
|
|
22
|
|
23 template <int M> struct bar {};
|
|
24
|
|
25 foo<bar<2>,bar<2> > x;
|