[Bug c++/83116] [6/7/8 Regression] Statement with no effect causes wrong code of static object constexpr method
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 23 14:50:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83116
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-11-23
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r230365.
Guess we need to remove the static var from constexpr caches at the end of
construction if the var isn't constexpr.
Testcase modified for the testsuite:
// PR c++/83116
// { dg-do run { target c++14 } }
struct S {
constexpr S () : s(0) { foo (); }
constexpr int foo () { return s; }
int s;
};
int
main ()
{
static S var;
var.s = 5;
if (var.s != 5 || var.foo () != 5)
__builtin_abort ();
}
More information about the Gcc-bugs
mailing list