1 // { dg-do run }
2 // Origin: Jo Totland <jototland@hotmail.com>
3 
4 // PR c++/6620
5 // Partial specialization involving expression of non-type template
6 // parameter causes ICE.
7 
8 extern "C" void abort();
9 
10 template <int N> struct HoldInt
11 {
12 };
13 
14 template <class A, class B> struct Add
15 {
16 };
17 
18 template <int N> struct Add<HoldInt<N>, HoldInt<-N> >
19 {
20   typedef int type;
21   int f() { return 0; }
22 };
23 
24 template <int N, int M>
25 struct Add<HoldInt<N>, HoldInt<M> >
26 {
27   typedef HoldInt<N+M> type;
28   int f() { return 1; }
29 };
30 
31 int main() {
32   Add<HoldInt<1>, HoldInt<-1> > a;
33   Add<HoldInt<1>, HoldInt<-2> > b;
34   if (a.f() != 0 || b.f() != 1)
35     abort();
36 }
37