The following four lines of code: #include <typeinfo> struct B { template <typename U> struct C; }; template <typename T> struct A { typedef typename T::C V; }; void f () { A<B>::V p; } Result in an internal compiler error: "internal error: Segmentation fault" Release: gcc version 3.2 (mingw special 20020817-1) Environment: Windows XP, gcc configure options: --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared How-To-Repeat: Compile the four lines of code (see problem description).
Fix: http://gcc.gnu.org/ml/gcc-patches/2002-10/msg01874.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. The example can be reduced a little bit further: -------------------------snip here------------------------- struct B { template <typename U> struct C; }; template <typename T> struct A { typedef typename T::C V; }; A<B>::V p; -------------------------snip here------------------------- Compiling this with "g++ -c" using the 3.2-branch or the main trunk results in an ICE (checked on i686-pc-linux-gnu). With gcc 3.0.x or 2.95.x I get an error message: PR8149.cc:3: aggregate `B::C<U> p' has incomplete type and cannot be initialized PR8149.cc:3: storage size of `p' isn't known Changing "struct C;" to "struct C{};" in the first line to get rid of this message (the rest of the code still remains illegal) causes gcc 3.0.x to issue an ICE and 2.95.x to issue an assembler error.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.2.1.
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8149 Date: 31 Oct 2002 00:02:36 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_2-branch Changes by: mmitchel@gcc.gnu.org 2002-10-30 16:02:36 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog decl.c typeck2.c Added files: gcc/testsuite/g++.dg/template: complit1.C typename4.C Log message: PR c++/8160 * g++.dg/template/complit1.C: New test. PR c++/8149 * g++.dg/template/typename4.C: Likewise. PR c++/8160 * typeck2.c (process_init_constructor): Call complete_array_type. PR c++/8149 * decl.c (make_typename_type): Issue errors about invalid results. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.43&r2=1.1672.2.166.2.44 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/complit1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/typename4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.37&r2=1.2685.2.114.2.38 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.866.2.36.2.11&r2=1.866.2.36.2.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.117.2.2.2.1&r2=1.117.2.2.2.2
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/8149 Date: 31 Oct 2002 00:04:13 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2002-10-30 16:04:13 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog decl.c typeck2.c Added files: gcc/testsuite/g++.dg/template: complit1.C typename4.C Log message: PR c++/8160 * typeck2.c (process_init_constructor): Call complete_array_type. PR c++/8149 * decl.c (make_typename_type): Issue errors about invalid results. PR c++/8160 * g++.dg/template/complit1.C: New test. PR c++/8149 * g++.dg/template/typename4.C: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2193&r2=1.2194 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/complit1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/typename4.C.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3032&r2=1.3033 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.958&r2=1.959 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck2.c.diff?cvsroot=gcc&r1=1.131&r2=1.132