[Bug c++/67104] [5/6 regression] Constant expression factory function initializes std::array with static storage duration strangely

2015-08-13 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67104

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Markus Trippelsdorf  ---
fixed.


[Bug c++/67104] [5/6 regression] Constant expression factory function initializes std::array with static storage duration strangely

2015-08-12 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67104

--- Comment #8 from Jason Merrill  ---
Author: jason
Date: Wed Aug 12 18:08:45 2015
New Revision: 226833

URL: https://gcc.gnu.org/viewcvs?rev=226833&root=gcc&view=rev
Log:
PR c++/67104
* constexpr.c (cxx_eval_array_reference): Fix typo.

Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c


[Bug c++/67104] [5/6 regression] Constant expression factory function initializes std::array with static storage duration strangely

2015-08-12 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67104

--- Comment #7 from Jason Merrill  ---
Author: jason
Date: Wed Aug 12 18:02:43 2015
New Revision: 226830

URL: https://gcc.gnu.org/viewcvs?rev=226830&root=gcc&view=rev
Log:
PR c++/67104
* constexpr.c (cxx_eval_array_reference): Handle sparse
CONSTRUCTORs.

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-array1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c


[Bug c++/67104] [5/6 regression] Constant expression factory function initializes std::array with static storage duration strangely

2015-08-07 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67104

--- Comment #6 from Markus Trippelsdorf  ---
Another example
http://stackoverflow.com/questions/31878796/removing-constexpr-changes-values-of-array-on-gcc

markus@x4 tmp % cat test.ii
template  struct array
{
  constexpr T &operator[](int index) { return data[index]; }
  constexpr T operator[](int index) const { return data[index]; }
  T data[N];
};

constexpr array
make_bottle_count ()
{
  array a{};
  a[65] = 1;
  return a;
}

constexpr auto bottle_count = make_bottle_count ();
static_assert (bottle_count[65], "");

markus@x4 tmp % clang++ -c -std=c++14 test.ii
markus@x4 tmp % g++ -c -std=c++14 test.ii
test.ii:17:1: error: static assertion failed: 
 static_assert (bottle_count[65], "");
 ^


[Bug c++/67104] [5/6 regression] Constant expression factory function initializes std::array with static storage duration strangely

2015-08-04 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67104

Markus Trippelsdorf  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||jason at gcc dot gnu.org
Summary|Constant expression factory |[5/6 regression] Constant
   |function initializes|expression factory function
   |std::array with static  |initializes std::array with
   |storage duration strangely  |static storage duration
   ||strangely

--- Comment #5 from Markus Trippelsdorf  ---
Started with r217663 (C++14 constexpr support).