Bug 51327 - [c++0x] [4.7 Regression] ICE with invalid constexpr parameter
Summary: [c++0x] [4.7 Regression] ICE with invalid constexpr parameter
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P5 normal
Target Milestone: 4.7.0
Assignee: Paolo Carlini
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-11-27 21:56 UTC by Volker Reichelt
Modified: 2012-01-29 21:43 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-11-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2011-11-27 21:56:09 UTC
The following invalid code snippet triggers an ICE on trunk (when compiled with "-std=c++0x"):

=======================================
struct A
{
  A(int);
};

struct B : A {};

constexpr int foo(B) { return 0; }
=======================================

bug.cc: In function 'constexpr int foo(B)':
bug.cc:8:15: error: invalid type for parameter 1 of constexpr function 'constexpr int foo(B)'
bug.cc:6:8: note: 'B' is not literal because:
bug.cc:6:8: note:   'B' is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor
bug.cc:8:34: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2011-11-30 19:40:05 UTC
Confirmed.
Comment 2 Paolo Carlini 2011-11-30 21:25:44 UTC
On it.
Comment 3 paolo@gcc.gnu.org 2012-01-29 21:41:58 UTC
Author: paolo
Date: Sun Jan 29 21:41:54 2012
New Revision: 183684

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183684
Log:
/cp
2012-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51327
	* class.c (explain_non_literal_class): Correctly handle implicitly
	deleted constructors.

/testsuite
2012-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51327
	* g++.dg/cpp0x/constexpr-ice6.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-ice6.C
Modified:
    trunk/gcc/cp/class.c
Comment 4 paolo@gcc.gnu.org 2012-01-29 21:43:00 UTC
Author: paolo
Date: Sun Jan 29 21:42:56 2012
New Revision: 183685

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183685
Log:
/cp
2012-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51327
	* class.c (explain_non_literal_class): Correctly handle implicitly
	deleted constructors.

/testsuite
2012-01-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51327
	* g++.dg/cpp0x/constexpr-ice6.C: New.


Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2012-01-29 21:43:42 UTC
Done.