[Bug c++/80864] [7/8/9 Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2019-01-31 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

--- Comment #9 from Marek Polacek  ---
Author: mpolacek
Date: Thu Jan 31 20:21:11 2019
New Revision: 268428

URL: https://gcc.gnu.org/viewcvs?rev=268428=gcc=rev
Log:
PR c++/89083, c++/80864 - ICE with list initialization in template.
* constexpr.c (adjust_temp_type): Use copy_node and change the type
instead of using build_constructor.
* decl.c (reshape_init_r): Don't reshape a digested initializer.
Return the initializer for COMPOUND_LITERAL_P.

* g++.dg/cpp0x/initlist107.C: New test.
* g++.dg/cpp0x/initlist108.C: New test.
* g++.dg/cpp0x/initlist109.C: New test.
* g++.dg/cpp0x/initlist110.C: New test.
* g++.dg/cpp0x/initlist111.C: New test.
* g++.dg/cpp0x/initlist112.C: New test.
* g++.dg/init/ptrfn4.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/initlist107.C
trunk/gcc/testsuite/g++.dg/cpp0x/initlist108.C
trunk/gcc/testsuite/g++.dg/cpp0x/initlist109.C
trunk/gcc/testsuite/g++.dg/cpp0x/initlist110.C
trunk/gcc/testsuite/g++.dg/cpp0x/initlist111.C
trunk/gcc/testsuite/g++.dg/cpp0x/initlist112.C
trunk/gcc/testsuite/g++.dg/init/ptrfn4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/80864] [7/8/9 Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2019-01-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #8 from Marek Polacek  ---
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01700.html

[Bug c++/80864] [7/8/9 Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2019-01-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c++/80864] [7/8/9 Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2019-01-28 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

--- Comment #7 from Marek Polacek  ---
Probably the same issue as in 89083 -- which I'm currently assigned to.

[Bug c++/80864] [7/8/9 Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-12-06 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.4 |7.5

[Bug c++/80864] [7/8/9/ Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-11-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/80864] [7/8/9/ Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-11-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

--- Comment #6 from Marek Polacek  ---
*** Bug 88028 has been marked as a duplicate of this bug. ***

[Bug c++/80864] [7/8/9/ Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-11-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

--- Comment #5 from Marek Polacek  ---
Another test from PR88028:

struct S {};
struct A { S s[1]; };

template 
struct R { static constexpr auto h = A{S{}}; };

A foo = R::h;

[Bug c++/80864] [7/8/9/ Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-11-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

--- Comment #4 from Marek Polacek  ---
Expanded testcase:

struct S {
  char c[1];
};

template 
void
fn ()
{
   constexpr S s1 = S{};
   constexpr S s2 = S{{}};
   constexpr S s3 = S{{{}}};
   constexpr S s4 = {};
   constexpr S s5 = {{}};
   constexpr S s6 = {{{}}};
   constexpr S s7{{}};
   constexpr S s8{S{}};
   constexpr S s9{S{{}}};
   constexpr S s10{S{{{;
   constexpr S s11 = S();
   constexpr S s12 = S({});
   constexpr S s13 = S({{}});
   constexpr S s14 = {{}};
   constexpr S s15 = {{{}}};
}

void
foo ()
{
  fn();
}

[Bug c++/80864] [7/8/9/ Regression] Brace-initialization of a constexpr variable of an array in a POD triggers ICE from templates

2018-11-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80864

Marek Polacek  changed:

   What|Removed |Added

  Known to work||4.9.4
   Target Milestone|--- |7.4
Summary|Brace-initialization of a   |[7/8/9/ Regression]
   |constexpr variable of an|Brace-initialization of a
   |array in a POD triggers ICE |constexpr variable of an
   |from templates  |array in a POD triggers ICE
   ||from templates

--- Comment #3 from Marek Polacek  ---
It's a regression: GCC 4.9.4 compiled it.