https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64989
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|wrong-code |rejects-valid Last reconfirmed|2015-03-18 00:00:00 |2016-3-9 CC| |msebor at gcc dot gnu.org Known to fail| |4.9.3, 5.3.0, 6.0 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- The test case is still rejected in 6.0 (thus changing the wrong-code keyword to rejects-valid). The problem seems to be using the this pointer since in test case below, the first case is accepted. $ cat z.c && /home/msebor/build/gcc-trunk-svn/gcc/xg++ -B/home/msebor/build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic z.c struct A { const void *p; constexpr A (const void *p): p (p) { } }; constexpr A a[2] = { a, a + 1 }; static_assert (a [1].p == a + 1, "#1"); struct B { const void *p; constexpr B (): p (this) { } }; constexpr B b[2]; static_assert (b [1].p == b + 1, "#2"); z.c:17:1: error: non-constant condition for static assertion static_assert (b [1].p == b + 1, "#2"); ^~~~~~~~~~~~~ z.c:17:1: error: the value of ‘b’ is not usable in a constant expression z.c:16:13: note: ‘b’ used in its own initializer constexpr B b[2]; ^