Bug 55226 - [4.8 Regression] ICE regression in regard to anonymous unions and constexpr
Summary: [4.8 Regression] ICE regression in regard to anonymous unions and constexpr
Status: RESOLVED DUPLICATE of bug 54922
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 54922
  Show dependency treegraph
 
Reported: 2012-11-07 07:45 UTC by Daniel Krügler
Modified: 2012-11-07 11:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-11-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Krügler 2012-11-07 07:45:08 UTC
The following code gives me now a regressive ICE when switching from my previous gcc 4.8 (last successfully tested: 4.8.0 20121014 (experimental)) to gcc 4.8.0 20121104 (experimental) using the compiler flags

-Wall -pedantic -std=c++11

//----------------------
template<class T>
struct optional_data
{
  union {
    unsigned char for_value_init_;
    T value_;
  };

  constexpr optional_data() : for_value_init_() {}
};

struct ncnm
{
  ncnm(ncnm&&) = delete;
  ncnm(const ncnm&) = delete;
};

int main()
{
  optional_data<ncnm> o; // #20
}
//----------------------

"In function 'int main()':|
20|internal compiler error: in gimplify_init_ctor_eval, at gimplify.c:3787|
"

A tentative guess is that this could have been a side-effect of the fix applied to bug 54922.
Comment 1 Paolo Carlini 2012-11-07 10:52:16 UTC
I'm going to revert for now the fix for 54922. This one is essentially just a duplicate of that one, simply trying to use the user defined type:

class nullable_int
{
  bool init_;
  union {
    unsigned char for_value_init;
    int value_;
  };
public:
  constexpr nullable_int() : init_(false), for_value_init() {}
};

int main()
{
  nullable_int n;
}
Comment 2 paolo@gcc.gnu.org 2012-11-07 11:15:48 UTC
Author: paolo
Date: Wed Nov  7 11:15:40 2012
New Revision: 193292

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

	PR c++/55226
	Revert:
	2012-10-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54922
	* semantics.c (cx_check_missing_mem_inits): Handle anonymous union
	members.

/testsuite
2012-11-07  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55226
	Revert:
	2012-10-23  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54922
	* g++.dg/cpp0x/constexpr-union4.C: New.

Removed:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Paolo Carlini 2012-11-07 11:16:37 UTC
See PR54922.

*** This bug has been marked as a duplicate of bug 54922 ***