Bug 48089 - [C++0x] ICE on in(?)valid in constexpr constructors
Summary: [C++0x] ICE on in(?)valid in constexpr constructors
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks: 48892 48993
  Show dependency treegraph
 
Reported: 2011-03-12 09:00 UTC by Magnus Fromreide
Modified: 2011-08-06 04:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.0
Known to fail: 4.6.0
Last reconfirmed: 2011-03-12 13:11:18


Attachments
Example showing the problem (66 bytes, text/x-c++src)
2011-03-12 09:00 UTC, Magnus Fromreide
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Fromreide 2011-03-12 09:00:07 UTC
Created attachment 23635 [details]
Example showing the problem

Trying to mark a value as don't care using the gcc extension of initializing it with itself triggers an ICE in lookup_parameter_binding.
Comment 1 Jonathan Wakely 2011-03-12 13:11:18 UTC
I guess an ICE is one way to solve the missing diagnostic for PR 18016 ;)

4.5 didn't ICE, but then constexpr was ignored so I'm not sure it counts as a regression
Comment 2 Jonathan Wakely 2011-03-12 13:20:53 UTC
N.B. I don't think there's any GCC extension involving initializing class members with themselves. Doing so is almost certainly a mistake.
Comment 3 Jason Merrill 2011-03-17 02:36:33 UTC
Author: jason
Date: Thu Mar 17 02:36:29 2011
New Revision: 171086

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171086
Log:
	PR c++/48089
	* semantics.c (potential_constant_expression_1): Don't allow *this
	in a constructor.
	(register_constexpr_fundef): Use potential_rvalue_constant_expression.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-03-17 02:42:06 UTC
Fixed for 4.7.  Will backport for 4.6.1.
Comment 5 Jason Merrill 2011-03-29 18:47:46 UTC
Author: jason
Date: Tue Mar 29 18:47:43 2011
New Revision: 171687

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171687
Log:
	PR c++/48089
	* semantics.c (potential_constant_expression_1): Change error about
	use of *this in constructor into sorry.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
Comment 6 Jason Merrill 2011-05-06 21:58:25 UTC
Author: jason
Date: Fri May  6 21:58:22 2011
New Revision: 173513

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173513
Log:
	PR c++/48089
	* semantics.c (potential_constant_expression_1): Don't allow *this
	in a constructor.
	(register_constexpr_fundef): Use potential_rvalue_constant_expression.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/semantics.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 7 Jason Merrill 2011-05-06 22:00:31 UTC
Fixed for 4.6.1.