Bug 28269 - [4.2 regression] ICE on attribute for invalid template
Summary: [4.2 regression] ICE on attribute for invalid template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Lee Millward
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-07-05 12:37 UTC by Volker Reichelt
Modified: 2006-07-15 15:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-07-09 20:00:24


Attachments

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

============================================================
template<int> struct A;

struct __attribute__((unused)) A<0<;
============================================================

bug.cc:3: error: template argument 1 is invalid
bug.cc:3: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in cp_parser_elaborated_type_specifier, at cp/parser.c:10245
Please submit a full bug report, [etc.]
Comment 1 patchapp@dberlin.org 2006-07-09 19:55:16 UTC
Subject: Bug number PR c++/28269

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-07/msg00383.html
Comment 2 Lee Millward 2006-07-15 15:00:50 UTC
Subject: Bug 28269

Author: lmillward
Date: Sat Jul 15 15:00:28 2006
New Revision: 115475

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115475
Log:
	PR c++/28269
	* parser.c (cp_parser_elaborated_type_specifier):
	Return early if an invalid type was detected.

	* g++.dg/template/crash54.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/template/crash54.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Lee Millward 2006-07-15 15:01:11 UTC
Fixed.