The following invalid c++ class produces an internal compiler error in at the map.insert(std::pair) statement, in c_expand_expr, which is in c-common.c:3715. -------------------------- #include <map> class test { public: test(){}; ~test(){}; void Test(); private: std::multimap<int, char* > mMap; }; void test::Test() { mMap.insert(std::pair); } //Illegal ---------------------------------- Output from g++: In member function `void test::Test()': test.cpp:13: Internal compiler error in c_expand_expr, at c-common.c: 3714 This may be related to bug 3079 and 2650. The code is clearly not legal, but probably shouldn't have produced such an error. Release: gcc version 3.2.3 20030415 (Debian prerelease) Environment: Debian 2.4.17 How-To-Repeat: invoke g++ test.cpp -o test.o
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. Though the error happens even earlier (in a tree check function) if checking is enabled. Here's a smaller testcase: -------------------------- namespace NS { template <typename> struct C { template <typename U> C (U); }; struct X { X(C<int>); }; } NS::X x(NS::C); -------------------------- It crashes 3.3 as follows: g/x> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c x.cc x.cc:11: internal compiler error: Segmentation fault Please submit a full bug report, 3.4 gives a useful error message on this as well as the original testcase. 2.95 crashes on this one, but it doesn't crash on the original testcase, so this is a 3.3 (not 3.4) regression. W.
To justify the stamp "regression", here's a testcase that crashes gcc 3.0 - 3.3, but not gcc 2.95.x and mainline: -------------------------------------------------------------------- namespace N { template <typename> struct A { template <typename T> A(A<T>); }; } void foo(N::A<int>); void bar() { foo(N::A); } --------------------------------------------------------------------
Moving target back to 3.3.1.
Subject: Bug 10558 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-07-11 08:39:58 Modified files: gcc/cp : ChangeLog parse.y gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: template8.C Log message: PR c++/10558 * parse.y (class_template_ok_as_expr): New variable. (template_arg_1): New non-terminal. (primary): Issue errors about uses of class templates as expressions. PR c++/10558 * g++.dg/parse/template8.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.178&r2=1.3076.2.179 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.284.2.7&r2=1.284.2.8 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.225&r2=1.2261.2.226 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/template8.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 10558 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-07-11 08:41:44 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/parse: template8.C Log message: PR c++/10558 * g++.dg/parse/template8.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2865&r2=1.2866 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/template8.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Fixed in GCC 3.3.1.
Subject: Bug 10558 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-07-11 08:53:59 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: nontype2.C Log message: PR c++/8164 * decl.c (duplicate_decls): Avoid mangling names unnecessarily. PR c++/8164 * g++.dg/template/nontype2.C: New test. PR c++/10558 * g++.dg/parse/template8.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2866&r2=1.2867 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/nontype2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2