Bug 37555 - [4.2 regression] ICE with invalid typedef
Summary: [4.2 regression] ICE with invalid typedef
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P5 minor
Target Milestone: 4.3.3
Assignee: Simon Martin
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2008-09-17 06:32 UTC by Volker Reichelt
Modified: 2009-03-31 15:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.3 4.4.0
Known to fail: 4.0.0 4.2.5
Last reconfirmed: 2008-09-27 10:58:49


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-09-17 06:32:15 UTC
The following invalid code snippet triggers an ICE since GCC 3.4.0:

========================
struct A {};

typedef void (A::T)();

void foo()
{
  T t;
  t;
}
========================

bug.cc:3: error: typedef name may not be a nested-name-specifier
bug.cc: In function 'void foo()':
bug.cc:8: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2008-09-18 19:42:41 UTC
Confirmed.
#0  maybe_dummy_object (type=???, binfop=???) at /Users/apinski/src/local/gcc/gcc/cp/tree.c:2067

Comment 2 Simon Martin 2008-09-27 10:58:49 UTC
Patch posted here:
  http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01880.html
Comment 3 Simon Martin 2008-09-30 19:27:01 UTC
Subject: Bug 37555

Author: simartin
Date: Tue Sep 30 19:25:35 2008
New Revision: 140794

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140794
Log:
gcc/cp/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    PR c++/37556
	    * decl.c (grokdeclarator): Set the type for typedefs to a
	    nested-name-specifier to error_mark_node.

gcc/testsuite/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    * g++.dg/parse/error32.C: New test.

	    PR c++/37556
	    * g++.dg/parse/error33.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/error32.C
    trunk/gcc/testsuite/g++.dg/parse/error33.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Simon Martin 2008-09-30 19:57:36 UTC
Subject: Bug 37555

Author: simartin
Date: Tue Sep 30 19:56:13 2008
New Revision: 140796

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140796
Log:
gcc/cp/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    * decl.c (grokdeclarator): Set the type for typedefs to a
	    nested-name-specifier to error_mark_node.

gcc/testsuite/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    * g++.dg/parse/error32.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/parse/error32.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/decl.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 5 Simon Martin 2008-09-30 20:01:16 UTC
Fixed in 4.3.3 and 4.4.0.
Comment 6 Joseph S. Myers 2009-03-31 15:48:55 UTC
Closing 4.2 branch, fixed for 4.3.3 and 4.4.