Original-Message-ID: <37E78776.36C42062@carter.net> Date: Tue, 21 Sep 1999 08:26:14 -0500 [Original report simplified] Under gcc-2.95.1, on 'i686-pc-linux-gnu' the code below returns a syntax error on compilation. This same code compiled fine way back around egcs-1.0, but has been broken since 1.1 or thereabouts. For the curious, this is part of the type promotion code for a template-metaprogram implementation of lisp I'm working on (maybe a future Master's Thesis project). Casey Carter Release: 2.95.2 How-To-Repeat: template <int N> class Int { public: typedef Int val; }; template <char C> class Char { public: typedef Char val; }; template <class A, class B> class NumPromote {}; template <char C, int N> class NumPromote< Char <C>, Int <N> > { public: typedef Int<C> val; typedef Int<N> val1; }; template <int N, char C> class NumPromote< Int<N>, Char<C> > { public: typedef Int<N> val; typedef Int<C> val1; }; static NumPromote< Char<69>, Int<0> >::val ci0; static NumPromote< Char<69>, Int<0> >::val1 ci1; static NumPromote< Int<0>, Char<69> >::val ic0; static NumPromote< Int<0>, Char<69> >::val1 ic1;
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed as a bug
From: loewis@gcc.gnu.org To: casey@carter.net, gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org Cc: Subject: Re: c++/45 Date: 9 Mar 2000 07:29:01 -0000 Old Synopsis: [not accepted] Template Specialization New Synopsis: Template Specialization State-Changed-From-To: open->analyzed State-Changed-By: loewis State-Changed-When: Wed Mar 8 23:29:01 2000 State-Changed-Why: Confirmed as a bug http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=45&database=gcc
Responsible-Changed-From-To: unassigned->nathan Responsible-Changed-Why: Patch in progress
From: nathan@gcc.gnu.org To: casey@carter.net, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de, nathan@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/45: Template Specialization Date: 30 Nov 2001 21:49:33 -0000 Synopsis: Template Specialization Responsible-Changed-From-To: unassigned->nathan Responsible-Changed-By: nathan Responsible-Changed-When: Fri Nov 30 13:49:31 2001 Responsible-Changed-Why: Patch in progress http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=45&database=gcc
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu> To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org> Cc: Subject: Re: c++/45: Template Specialization Date: Tue, 22 Oct 2002 18:51:23 -0500 (CDT) Someone should re-name this report to "Matching of partial specialization of classes" Here's a redux: ----------------------------------------- template <int N> struct Int {}; template <char C> struct Char{}; template <typename A, typename B> struct X; template <char C, int N> struct X< Char<C>, Int<N> > { typedef Int<C> val; }; template <int N, char C> struct X< Int<N>, Char<C> > { typedef Int<N> val; }; X< Int<0>, Char<'1'> >::val i; ---------------------------------------- In ways I don't understand, this bug goes away if in the declaration of the second partial specialization, "int N" and "char C" is reversed, something that should have absolutely no effect on matching of templates. In some other ways I do not understand either, the problem also goes away if I change the template argument of "Char" from "char" to "int", something that should also not affect matching, but does. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth
From: Wolfgang Bangerth <bangerth@apex68.ticam.utexas.edu> To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/45: Template Specialization Date: Thu, 14 Nov 2002 14:23:06 -0600 Re-confirmed with 3.3 CVS from 2002-11-10 and 3.2.1 pre from the same date.
State-Changed-From-To: analyzed->closed State-Changed-Why: 2002-12-26 Nathan Sidwell <nathan@codesourcery.com> PR c++/45, c++/3784 * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be the same too.
From: nathan@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/45 Date: 3 Jan 2003 17:21:15 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: nathan@gcc.gnu.org 2003-01-03 09:21:14 Modified files: gcc/cp : ChangeLog tree.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: ntp2.C Log message: cp: PR c++/45, c++/3784 * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be the same too. testsuite: * g++.dg/template/ntp2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3121&r2=1.3122 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.311&r2=1.312 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2317&r2=1.2318 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ntp2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
From: nathan@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/45 Date: 3 Jan 2003 17:38:34 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: nathan@gcc.gnu.org 2003-01-03 09:38:34 Modified files: gcc/cp : ChangeLog tree.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: ntp2.C Log message: cp: PR c++/45, c++/3784 * tree.c (cp_tree_equal, TEMPLATE_PARM_INDEX): The types must be the same too. testsuite: * g++.dg/template/ntp2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.11&r2=1.3076.2.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.307&r2=1.307.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.12&r2=1.2261.2.13 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ntp2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1