[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / template / partial1.C
blob41ea530396962987bbaa5c735a85f94cdb98100a
1 // { dg-do run }
2 // Origin: Jo Totland <jototland@hotmail.com>
4 // PR c++/6620
5 // Partial specialization involving expression of non-type template
6 // parameter causes ICE.
8 extern "C" void abort();
10 template <int N> struct HoldInt
14 template <class A, class B> struct Add
18 template <int N> struct Add<HoldInt<N>, HoldInt<-N> >
20   typedef int type;
21   int f() { return 0; }
24 template <int N, int M> 
25 struct Add<HoldInt<N>, HoldInt<M> >
27   typedef HoldInt<N+M> type;
28   int f() { return 1; }
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();