Bug 33836 - [4.2 regression] ICE with invalid use of &&
Summary: [4.2 regression] ICE with invalid use of &&
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P2 minor
Target Milestone: 4.3.0
Assignee: Jakub Jelinek
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-10-20 21:33 UTC by Volker Reichelt
Modified: 2009-03-30 22:31 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.0
Known to fail: 4.2.5
Last reconfirmed: 2007-10-29 13:33:17


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:33:51 UTC
The following invalid code snippet triggers an ICE since GCC 3.4.0:

===============================
template<int N> struct A
{
  enum { M = && N };
};

A<0> a;
===============================

bug.cc:3: error: label 'N' referenced outside of any function
bug.cc: In instantiation of 'A<0>':
bug.cc:6:   instantiated from here
bug.cc:3: internal compiler error: in perform_integral_promotions, at cp/typeck.c:1613
Please submit a full bug report, [etc.]
Comment 1 Jakub Jelinek 2007-10-29 12:42:30 UTC
enum { M = && N };
alone is enough to trigger this.
Comment 2 Jakub Jelinek 2007-11-05 08:18:08 UTC
Subject: Bug 33836

Author: jakub
Date: Mon Nov  5 08:18:03 2007
New Revision: 129896

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129896
Log:
	PR c++/33836
	* parser.c (cp_parser_unary_expression): For &&label call
	cp_parser_non_integral_constant_expression and return error_mark_node
	if it returned true.

	* g++.dg/ext/label10.C: New test.

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

Comment 3 Jakub Jelinek 2007-11-05 08:18:59 UTC
Fixed on the trunk so far.
Comment 4 Joseph S. Myers 2008-07-04 22:19:21 UTC
Closing 4.1 branch.
Comment 5 Joseph S. Myers 2009-03-30 22:31:57 UTC
Closing 4.2 branch, fixed in 4.3.