The following invalid code snippet triggers a segfault since GCC 3.4.0: ================================================== struct A { operator int(); }; struct B : virtual A, A<0> {}; int foo(B &b) { return b; } ================================================== bug.cc:6: error: expected template-name before '<' token bug.cc:6: error: expected `{' before '<' token bug.cc:6: error: expected unqualified-id before '<' token bug.cc: In function 'int foo(B&)': bug.cc:10: internal compiler error: Segmentation fault Please submit a full bug report, [etc.]
Backtrace: #0 0x08106fb5 in build_vfield_ref (datum=0xb7d6d760, type=0xb7da16d4) at ../../gcc/cp/class.c:554 #1 0x081063b3 in build_base_path (code=PLUS_EXPR, expr=0xb7d6d720, binfo=0xb7ff5800, nonnull=1) at ../../gcc/cp/class.c:355 #2 0x0805af73 in build_over_call (cand=0x951ca24, flags=3) at ../../gcc/cp/call.c:4821 #3 0x08058bb7 in convert_like_real (convs=0x951ca80, expr=0xb7d6d6e0, fn=0x0, argnum=0, inner=0, issue_conversion_warnings=1 '\001', c_cast_p=0 '\0') at ../../gcc/cp/call.c:4288 #4 0x08061984 in perform_implicit_conversion (type=0xb7cfe284, expr=0xb7d6d6e0) at ../../gcc/cp/call.c:6431 #5 0x081a1dcc in convert_for_assignment (type=0xb7cfe284, rhs=0xb7d6d6e0, errtype=0x8985c65 "return", fndecl=0x0, parmnum=0) at ../../gcc/cp/typeck.c:6234 #6 0x081a228f in convert_for_initialization (exp=0x0, type=0xb7cfe284, rhs=0xb7d6d6e0, flags=11, errtype=0x8985c65 "return", fndecl=0x0, parmnum=0) at ../../gcc/cp/typeck.c:6323 #7 0x081a3660 in check_return_expr (retval=0xb7d6d6e0, no_warning=0xbfce47eb "") at ../../gcc/cp/typeck.c:6591 #8 0x081d0668 in finish_return_stmt (expr=0xb7d6d6e0) at ../../gcc/cp/semantics.c:753
Subject: Bug number PR c++/29022 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00940.html
Subject: Bug number PR c++/29022 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01314.html
Subject: Bug 29022 Author: lmillward Date: Wed Nov 29 15:19:39 2006 New Revision: 119318 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119318 Log: PR c++/29022 * parser.c (cp_parser_class_head): Move processing of any base classes to... (cp_parser_class_specifier) ...here. Take an extra tree* parameter for any base classes. Only process them if the opening brace was found. * g++.dg/inherit/virtual2.C: New test. * g++.dg/inherit/virtual3.C: Likewise. * g++.old-deja/g++.bugs/900121_05.C: Adjust error markers. * g++.dg/inherit/error2.C: Likewise. * g++.dg/template/instantiate1.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/inherit/virtual2.C trunk/gcc/testsuite/g++.dg/inherit/virtual3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/inherit/error2.C trunk/gcc/testsuite/g++.dg/template/instantiate1.C trunk/gcc/testsuite/g++.old-deja/g++.bugs/900121_05.C
Fixed on mainline.
Subject: Bug 29022 Author: lmillward Date: Wed Nov 29 16:51:32 2006 New Revision: 119322 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119322 Log: PR c++/29022 * parser.c (cp_parser_class_head): Move processing of any base classes to... (cp_parser_class_specifier) ...here. Take an extra tree* parameter for any base classes. Only process them if the opening brace was found. * g++.dg/inherit/virtual2.C: New test. * g++.dg/inherit/virtual3.C: Likewise. * g++.old-deja/g++.bugs/900121_05.C: Adjust error markers. * g++.dg/inherit/error2.C: Likewise. * g++.dg/template/instantiate1.C: Likewise. Added: branches/gcc-4_2-branch/gcc/testsuite/g++.dg/inherit/virtual2.C branches/gcc-4_2-branch/gcc/testsuite/g++.dg/inherit/virtual3.C Modified: branches/gcc-4_2-branch/gcc/cp/ChangeLog branches/gcc-4_2-branch/gcc/cp/parser.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog branches/gcc-4_2-branch/gcc/testsuite/g++.dg/inherit/error2.C branches/gcc-4_2-branch/gcc/testsuite/g++.dg/template/instantiate1.C branches/gcc-4_2-branch/gcc/testsuite/g++.old-deja/g++.bugs/900121_05.C
Fixed in 4.2.
Subject: Bug 29022 Author: lmillward Date: Wed Nov 29 19:01:50 2006 New Revision: 119332 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119332 Log: PR c++/29022 * parser.c (cp_parser_class_head): Move processing of any base classes to... (cp_parser_class_specifier) ...here. Take an extra tree* parameter for any base classes. Only process them if the opening brace was found. * g++.dg/inherit/virtual1.C: New test. * g++.dg/inherit/virtual2.C: Likewise. * g++.old-deja/g++.bugs/900121_05.C: Adjust error markers. * g++.dg/inherit/error2.C: Likewise. * g++.dg/template/instantiate1.C: Likewise. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/inherit/virtual1.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/inherit/virtual2.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/parser.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/inherit/error2.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/instantiate1.C branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.bugs/900121_05.C
Fixed in 4.1.2.
Subject: Bug 29022 Author: lmillward Date: Sun Dec 3 13:11:51 2006 New Revision: 119463 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119463 Log: PR c++/29022 PR c++/27316 PR c++/28740 * parser.c (cp_parser_class_head): Move processing of any base classes to... (cp_parser_class_specifier) ...here. Take an extra tree* parameter for the base classes. Only process them if the opening brace was found. PR c++/29022 * g++.dg/inherit/virtual1.C: New test. * g++.dg/inherit/virtual2.C: Likewise. PR c++/27316 * g++.dg/inherit/error3.C: New test. PR c++/28740 * g++.dg/inherit/error4.C: New test. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/error3.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/error4.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/virtual1.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/virtual2.C Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/parser.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog branches/gcc-4_0-branch/gcc/testsuite/g++.dg/inherit/error2.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/instantiate1.C branches/gcc-4_0-branch/gcc/testsuite/g++.old-deja/g++.bugs/900121_05.C
Now fixed in 4.0.4.