Ice on compiling this single line of c++ template <class ForwardingPolicy > class CallStrategy::CallStrategy() Release: 3.1.1 Environment: System: Linux parore 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../../gcc-3.1.1/configure --prefix=/usr/local/gcc1541B --exec-prefix=/usr/local/gcc1541B How-To-Repeat: See description
State-Changed-From-To: open->analyzed State-Changed-Why: confirmed as a regression
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
From: Gabriel Dos Reis <gdr@integrable-solutions.net> To: Pop Sébastian <pop@gauvain.u-strasbg.fr> Cc: 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 Subject: Re: c++/7721: Very simple (but incorrect) template chokes g++ Date: 29 Sep 2002 16:36:45 +0200 Pop Sébastian <pop@gauvain.u-strasbg.fr> writes: [...] | Maybe we could give a better diagnostic for this error... | Gaby, can you help to fix this error? Yes, actually there are several instances of this ICE in tthe GNATS -- sorry I can't tell you off hand which ones (but I know there are more than two :-). I should submit a patch this week -- I've been gotten busy by more pressing things. -- Gaby
From: =?iso-8859-1?Q?Pop_S=E9bastian?= <pop@gauvain.u-strasbg.fr> To: Gabriel Dos Reis <gdr@integrable-solutions.net> Cc: 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 Subject: Re: c++/7721: Very simple (but incorrect) template chokes g++ Date: Wed, 9 Oct 2002 00:30:49 +0200 On Sun, Sep 29, 2002 at 04:36:45PM +0200, Gabriel Dos Reis wrote: > Pop Sébastian <pop@gauvain.u-strasbg.fr> writes: > > [...] > > | Maybe we could give a better diagnostic for this error... > | Gaby, can you help to fix this error? > > Yes, actually there are several instances of this ICE in tthe GNATS -- > sorry I can't tell you off hand which ones (but I know there are more > than two :-). I should submit a patch this week -- I've been gotten > busy by more pressing things. > Seems like PR#7721 and PR#7803 are the same bug ... More explicitly G++ dies on the same statement switch (TREE_CODE (decl)) { [...] default: => my_friendly_assert (0, 20020917); decl is on both PRs a template_decl: for PR#7721 (gdb) p debug_tree (decl) <template_decl 0x401ae000 CallStrategy type <record_type 0x401aae70 CallStrategy<ForwardingPolicy> type_5 VOID align 8 symtab 0 alias set -1 n_parents 0 use_template=0 interface-unknown pointer_to_this <pointer_type 0x401aaee0> chain <type_decl 0x401aaf50 CallStrategy<ForwardingPolicy>>> VOID file pr7721.ii line 2 align 1 arguments <tree_list 0x40199f00 purpose <integer_cst 0x40171b80 constant 1> value <tree_vec 0x40199eec type <template_decl 0x401ae000 CallStrategy> elt 0 <tree_list 0x40199ed8>>> result <type_decl 0x401aaf50 CallStrategy<ForwardingPolicy> type <record_type 0x401aae70 CallStrategy<ForwardingPolicy>> decl_2 VOID file pr7721.ii line 2 align 1 chain <type_decl 0x401aae00 ForwardingPolicy type <template_type_parm 0x401aad90 ForwardingPolicy> decl_0 VOID file pr7721.ii line 1 align 1>> chain <function_decl 0x4019c3f0 __cxa_call_unexpected>> $2 = void (gdb) for PR#7803 (gdb) p debug_tree (decl) <template_decl 0x4037ca10 allocator type <record_type 0x4037c8c0 allocator<_Alloc> type_1 type_2 type_5 VOID size <integer_cst 0x40171ce0 constant 0> align 8 symtab 0 alias set -1 fields <template_decl 0x4061c8c0 rebind type <record_type 0x4061c770 rebind<_Tp1>> ignored in_system_header VOID file ../usr/include/c++/3.3/bits/stl_alloc.h line 657 align 1 context <record_type 0x4037c8c0 allocator<_Alloc>> arguments <tree_list 0x40619e38 purpose <integer_cst 0x40171de0 constant 2> value <tree_vec 0x40619e24 type <template_decl 0x4061c8c0 rebind> elt 0 <tree_list 0x40619e10>> chain <tree_list 0x40619820 purpose <integer_cst 0x40171b80 constant 1> value <tree_vec 0x4061980c elt 0 <tree_list 0x406197f8>>>> result <type_decl 0x4061c850 rebind<_Tp1>> chain <type_decl 0x4061ac40 allocator>> context <namespace_decl 0x40174c40 std> ~X() X() X(constX&) n_parents 0 use_template=0 interface-unknown member-functions <tree_vec 0x4061b680 elt 0 <overload 0x40529780> elt 1 <function_decl 0x40620930 allocator> elt 2 <function_decl 0x40621380 allocate> elt 3 <function_decl 0x40621690 deallocate> elt 4 <overload 0x405297a0> elt 5 <function_decl 0x40621930 max_size> elt 6 <function_decl 0x40621d20 construct> elt 7 <function_decl 0x40623000 destroy>> pointer_to_this <pointer_type 0x4037c930> chain <type_decl 0x4037c9a0 allocator<_Alloc>>> in_system_header VOID file ../usr/include/c++/3.3/bits/stringfwd.h line 57 align 1 context <namespace_decl 0x40174c40 std> arguments <tree_list 0x4037d348 purpose <integer_cst 0x40171b80 1> value <tree_vec 0x4037d334 type <template_decl 0x4037ca10 allocator> elt 0 <tree_list 0x4037d320>>> result <type_decl 0x4037c9a0 allocator<_Alloc> type <record_type 0x4037c8c0 allocator<_Alloc>> in_system_header decl_2 VOID file ../usr/include/c++/3.3/bits/stl_alloc.h line 644 align 1 context <namespace_decl 0x40174c40 std> chain <type_decl 0x4037c850 _Alloc type <template_type_parm 0x4037c7e0 _Alloc> in_system_header decl_0 VOID file ../usr/include/c++/3.3/bits/stringfwd.h line 56 align 1>> chain <template_decl 0x4037c4d0 char_traits>> $3 = void (gdb)
Responsible-Changed-From-To: unassigned->gdr Responsible-Changed-Why: Analyzed.
State-Changed-From-To: analyzed->closed State-Changed-Why: http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00505.html