diff options
author | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-16 13:43:50 +0000 |
---|---|---|
committer | lerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-16 13:43:50 +0000 |
commit | 66da0aecd2e6ed4b0c20bbaf377395a97ddac8f1 (patch) | |
tree | 0d515ec700acc964bbf182734d4b8ff0ec745571 /gcc/testsuite/g++.dg/template/partial1.C | |
parent | 664dca4d8af31783ad3d4d0d1b384b67a1f2ff3c (diff) | |
download | gcc-66da0aecd2e6ed4b0c20bbaf377395a97ddac8f1.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53517 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/template/partial1.C')
-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 00000000000..41ea5303969 --- /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(); +} |