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
8extern "C" void abort();
9
10template <int N> struct HoldInt
11{
12};
13
14template <class A, class B> struct Add
15{
16};
17
18template <int N> struct Add<HoldInt<N>, HoldInt<-N> >
19{
20  typedef int type;
21  int f() { return 0; }
22};
23
24template <int N, int M>
25struct Add<HoldInt<N>, HoldInt<M> >
26{
27  typedef HoldInt<N+M> type;
28  int f() { return 1; }
29};
30
31int 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