Bug 33838 - [4.3 regression] ICE with invalid use of decltype
Summary: [4.3 regression] ICE with invalid use of decltype
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P4 normal
Target Milestone: 4.3.0
Assignee: dgregor
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-10-20 21:45 UTC by Volker Reichelt
Modified: 2007-12-02 22:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-11-05 20:32:52


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-10-20 21:45:12 UTC
The following invalid code snippet triggers an ICE on mainline:

===============================
template<typename T> struct A
{
  __decltype (T* foo());
};
===============================

bug.cc:3: error: expected primary-expression before '*' token
bug.cc:3: error: there are no arguments to 'foo' that depend on a template parameter, so a declaration of 'foo' 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:3: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]

The problem appeared between 2007-07-16 and 2007-08-15, presumably with
the introduction of decltype:

2007-07-27  Douglas Gregor  <doug.gregor@gmail.com>

	* typeck.c (structural_comptypes): Compare DECLTYPE_TYPE nodes.
	* cp-tree.def (DECLTYPE_TYPE): New.
	* error.c (dump_type): Dump DECLTYPE_TYPE nodes.
        ...
Comment 1 dgregor 2007-10-26 18:38:16 UTC
Same problem as in 33839; fixed by that patch.

*** This bug has been marked as a duplicate of 33839 ***
Comment 2 Volker Reichelt 2007-10-28 21:19:00 UTC
While PR33839 and PR33837 got fixed, this ICE still persists.
Comment 3 dgregor 2007-11-07 23:37:51 UTC
Subject: Bug 33838

Author: dgregor
Date: Wed Nov  7 23:37:29 2007
New Revision: 129975

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129975
Log:
2007-11-07  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/33045
	PR c++/33837
	PR c++/33838
	* semantics.c (finish_decltype_type): See through INDIRECT_REFs.
	Be careful with ERROR_MARK_NODEs.
	* parser.c (cp_parser_check_access_in_redeclaration): Handle NULL
	argument.
	
2007-11-07  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/33045
	PR c++/33837
	PR c++/33838
	* g++.dg/cpp0x/decltype-33837.C: New.
	* g++.dg/cpp0x/decltype-refbug.C: New.
	* g++.dg/cpp0x/decltype-33838.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype-33838.C
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype-refbug.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 dgregor 2007-11-07 23:40:11 UTC
Fixed