I think the following should be accepted: constexpr const int A = 42; const int &B = A; static_assert(&A == &B, "Bug"); int main() {return 0;} Indeed, even if B is not constexpr its address is. On the contrary GCC complains with bug2.cpp:3:1: error: non-constant condition for static assertion static_assert(&A == &B, "Bug"); ^ bug2.cpp:3:1: error: the value of ‘B’ is not usable in a constant expression bug2.cpp:2:12: note: ‘B’ was not declared ‘constexpr’ const int &B = A;
The problem remains with the newly released GCC 4.9.0. I've upgraded the tag.
THere's no need to update the version - if the bug is still open t hat means it's still a bug in later versions, and by changing it you've lost the information that the bug is present in 4.8
*** Bug 70247 has been marked as a duplicate of this bug. ***
As shown in the duplicate bug 70247 the top of the trunk of 6.0 still rejects this code.
This is fixed in 7.1.0. I'm adding the testcase and closing the bug.
Author: paolo Date: Fri May 12 17:53:54 2017 New Revision: 247986 URL: https://gcc.gnu.org/viewcvs?rev=247986&root=gcc&view=rev Log: 2017-05-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/60430 * g++.dg/cpp0x/pr60430.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr60430.C Modified: trunk/gcc/testsuite/ChangeLog
Done.