Bug 29363 - [4.3/4.4/4.5 regression] ICE throwing undeclared object
Summary: [4.3/4.4/4.5 regression] ICE throwing undeclared object
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 minor
Target Milestone: 4.5.0
Assignee: Jason Merrill
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Reported: 2006-10-05 23:37 UTC by Volker Reichelt
Modified: 2009-11-13 18:48 UTC (History)
4 users (show)

See Also:
Known to work: 4.1.1 4.1.2
Known to fail: 4.2.0
Last reconfirmed: 2009-11-13 17:51:12


Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-10-05 23:37:02 UTC
The following invalid code snippet triggers an ICE on mainline:

template<int> void foo()
  throw A();
  struct A {} a;

template void foo<0>();

bug.cc: In function 'void foo()':
bug.cc:3: error: there are no arguments to 'A' that depend on a template parameter, so a declaration of 'A' must be available
bug.cc:3: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
bug.cc: In function 'void foo() [with int <anonymous> = 0]':
bug.cc:7:   instantiated from here
bug.cc:3: error: 'A' was not declared in this scope
bug.cc: At global scope:
bug.cc: In instantiation of 'foo() [with int <anonymous> = 0]::A':
bug.cc:4:   instantiated from 'void foo() [with int <anonymous> = 0]'
bug.cc:7:   instantiated from here
bug.cc:4: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-10-06 03:51:36 UTC
Comment 2 Andrew Pinski 2006-10-08 02:44:24 UTC
typedecl = TYPE_MAIN_DECL (type);
typedecl is NULL here.
struct AD.1953 is the type.
Comment 3 Lee Millward 2006-10-17 23:44:30 UTC
Testing a patch.
Comment 4 patchapp@dberlin.org 2006-10-18 15:00:39 UTC
Subject: Bug number PR c++/29363

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/msg00914.html
Comment 5 Mark Mitchell 2007-05-14 22:26:08 UTC
Will not be fixed in 4.2.0; retargeting at 4.2.1.
Comment 6 Mark Mitchell 2007-10-09 19:21:13 UTC
Change target milestone to 4.2.3, as 4.2.2 has been released.
Comment 7 Steven Bosscher 2007-12-21 07:28:54 UTC

Patch was rejected: http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00976.html

Was it your plan to give it another try from behind the drawing board? :-)
Comment 8 Joseph S. Myers 2008-02-01 16:53:33 UTC
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
Comment 9 Joseph S. Myers 2008-05-19 20:22:58 UTC
4.2.4 is being released, changing milestones to 4.2.5.
Comment 10 Andrew Pinski 2008-08-16 23:20:22 UTC
This bug should never have been in the waiting state, waiting state is for waiting on information from the reporter and not another developer.
Comment 11 Andrew Pinski 2008-08-16 23:21:38 UTC
Also this seems like this should be a P4 or lower as it is an error recovery issue.
Comment 12 Joseph S. Myers 2009-03-31 19:47:20 UTC
Closing 4.2 branch.
Comment 13 Richard Biener 2009-08-04 12:27:59 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 14 Jason Merrill 2009-11-13 18:46:51 UTC
Subject: Bug 29363

Author: jason
Date: Fri Nov 13 18:46:39 2009
New Revision: 154163

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154163
	PR c++/29363
	* decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here.
	(cxx_init_decl_processing): Not here.
	* name-lookup.c (pushtag): Or here.
	* pt.c (lookup_template_class): Or here.


Comment 15 Jason Merrill 2009-11-13 18:48:30 UTC
Fixed for 4.5.