This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7721: Very simple (but incorrect) template chokes g++
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 29 Sep 2002 10:46:01 -0000
- Subject: Re: c++/7721: Very simple (but incorrect) template chokes g++
- Reply-to: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
The following reply was made to PR c++/7721; it has been noted by GNATS.
From: =?iso-8859-1?Q?Pop_S=E9bastian?= <pop@gauvain.u-strasbg.fr>
To: nathan@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
johnc@parore.tait.co.nz, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc: gdr@integrable-solutions.net
Subject: Re: c++/7721: Very simple (but incorrect) template chokes g++
Date: Sun, 29 Sep 2002 12:38:38 +0200
On Fri, Sep 13, 2002 at 09:27:23PM -0000, nathan@gcc.gnu.org wrote:
> Synopsis: Very simple (but incorrect) template chokes g++
>
> State-Changed-From-To: open->analyzed
> State-Changed-By: nathan
> State-Changed-When: Fri Sep 13 14:27:23 2002
> State-Changed-Why:
> confirmed as a regression
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7721
Tested with 3 different versions of gcc:
seb@myp233:~/test/cp$ gcc-2.95 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
seb@myp233:~/test/cp$ gcc-3.0 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4
seb@myp233:~/test/cp$ gcc-3.2 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.1/specs
Configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2.1ds2/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.1 20020924 (Debian prerelease)
Tested code:
seb@myp233:~/test/cp$ cat pr7721.cc
template <class ForwardingPolicy >
class CallStrategy::CallStrategy()
Results are:
seb@myp233:~/test/cp$ gcc-2.95 -c pr7721.cc
pr7721.cc:2: parse error before `('
seb@myp233:~/test/cp$ gcc-3.0 -c pr7721.cc
pr7721.cc:4: `template<ForwardingPolicy> class CallStrategy' as declarator
(compiler error)
pr7721.cc:4: syntax error at end of input
seb@myp233:~/test/cp$ gcc-3.2 -c pr7721.cc
pr7721.cc:4: `template<class ForwardingPolicy> struct CallStrategy' as
declarator
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
seb@myp233:~/test/cp$
The problem is in cp/decl.c: grokdeclarator ()
case TEMPLATE_DECL is missing in the switch, making the function to give up
on the default case label:
default:
=> my_friendly_assert (0, 20020917);
Previous version of this code was:
default:
- cp_compiler_error ("`%D' as declarator", decl);
- return 0; /* We used to do a 155 abort here. */
+ my_friendly_assert (0, 20020917);
Maybe we could give a better diagnostic for this error...
Gaby, can you help to fix this error?
Thanks,
Sebastian