diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2002-05-16 13:43:50 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2002-05-16 13:43:50 +0000 |
commit | e2005c8d2f6882483ffbf110b3427367b210020a (patch) | |
tree | 0d515ec700acc964bbf182734d4b8ff0ec745571 /gcc/testsuite | |
parent | 2605d809d9fb8d0246c5261f95cd13f6e8b956ce (diff) | |
download | gcc-e2005c8d2f6882483ffbf110b3427367b210020a.zip gcc-e2005c8d2f6882483ffbf110b3427367b210020a.tar.gz gcc-e2005c8d2f6882483ffbf110b3427367b210020a.tar.bz2 |
re PR c++/6620 (partial template specialization on int)
PR c++/6620
* pt.c (verify_class_unification): Don't check if PARM is template
parameter dependent. Simplify.
(unify) [TEMPLATE_PARM_INDEX]: Handle when ARG is a template
parameter dependent expression.
From-SVN: r53517
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/g++.dg/template/partial1.C | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/partial1.C b/gcc/testsuite/g++.dg/template/partial1.C new file mode 100644 index 0000000..41ea530 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial1.C @@ -0,0 +1,36 @@ +// { dg-do run } +// Origin: Jo Totland <jototland@hotmail.com> + +// PR c++/6620 +// Partial specialization involving expression of non-type template +// parameter causes ICE. + +extern "C" void abort(); + +template <int N> struct HoldInt +{ +}; + +template <class A, class B> struct Add +{ +}; + +template <int N> struct Add<HoldInt<N>, HoldInt<-N> > +{ + typedef int type; + int f() { return 0; } +}; + +template <int N, int M> +struct Add<HoldInt<N>, HoldInt<M> > +{ + typedef HoldInt<N+M> type; + int f() { return 1; } +}; + +int main() { + Add<HoldInt<1>, HoldInt<-1> > a; + Add<HoldInt<1>, HoldInt<-2> > b; + if (a.f() != 0 || b.f() != 1) + abort(); +} |