I've made a typo and as result I've produced this ICE: wilx@logout:::~/tmp> g++ -c testcase.cxx testcase.cxx: In member function `void X<T>::handler() [with T = S]': testcase.cxx:16: instantiated from here testcase.cxx:9: error: no type named `BaseType' in `struct S' testcase.cxx:9: internal compiler error: in finish_class_member_access_expr, at cp/typeck.c:1945 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Configuration: wilx@logout:::~/tmp> gcc -v Reading specs from /home/4/wilx/lib/gcc/i386-unknown-freebsd4.10/3.5.0/specs Configured with: ../srcdir/configure --disable-nls --enable-version-specific-runtime-libs --enable-dwarf2 --with-cpu=pentium3 --with-arch=pentium3 --with-system-zlib --disable-shared --prefix=/home/4/wilx --enable-languages=c,c++,objc --disable-sjlj-exceptions --enable-shared=libstdc++ --enable-shared=libobjc --with-gc=zone Thread model: posix gcc version 3.5.0 20040803 (experimental)
Created attachment 6896 [details] Testcase
Confirmed, an ICE after error. This is a regression over 3.3.4, which only issued the error. The testcase in the attachment is already nice and small. W.
It is, however, possible to make it even smaller :-) ------------------ template <typename T> struct X { X () { this->T::handler (); } }; template struct X<int>; -------------------- g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc x.cc: In constructor `X<T>::X() [with T = int]': x.cc:7: instantiated from here x.cc:3: internal compiler error: in finish_class_member_access_expr, at cp/typeck.c:1945 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W.
Note this is invalid code as T is not a base class of the template, we should have rejected it before got to this point.
The following example is even smaller, and it crashes the compiler since gcc 3.3: ================================ template<typename T> struct X { X() { this->T::i; } }; X<int> x; ================================
: Search converges between 2002-08-04-trunk (#84) and 2002-08-11-trunk (#85).
Subject: Bug 16904 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-08-11 22:13:32 Modified files: gcc/cp : ChangeLog parser.c pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: error16.C gcc/testsuite/g++.dg/template: error14.C error15.C Log message: PR c++/16964 * parser.c (cp_parser_class_specifier): Robustify. PR c++/16904 * pt.c (tsubst_copy_and_build): Complain about invalid qualification. PR c++/16929 * pt.c (tsubst_default_argument): Clear out current_class_ptr and current_class_ref while tsubsting. PR c++/16964 * g++.dg/parse/error16.C: New test. PR c++/16904 * g++.dg/template/error14.C: New test. PR c++/16929 * g++.dg/template/error15.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4269&r2=1.4270 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.233&r2=1.234 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.901&r2=1.902 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4118&r2=1.4119 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error16.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error14.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 16904 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-08-11 22:14:44 Modified files: gcc/cp : ChangeLog parser.c pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: error16.C gcc/testsuite/g++.dg/template: error14.C error15.C Log message: PR c++/16964 * parser.c (cp_parser_class_specifier): Robustify. PR c++/16904 * pt.c (tsubst_copy_and_build): Complain about invalid qualification. PR c++/16929 * pt.c (tsubst_default_argument): Clear out current_class_ptr and current_class_ref while tsubsting. PR c++/16964 * g++.dg/parse/error16.C: New test. PR c++/16904 * g++.dg/template/error14.C: New test. PR c++/16929 * g++.dg/template/error15.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.140&r2=1.3892.2.141 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.36&r2=1.157.2.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.36&r2=1.816.2.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.243&r2=1.3389.2.244 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error16.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error14.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error15.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.4.2.