Consider the following code:
constexpr const int A = 42;
const int &B = A;
static_assert(&A == &B, "Bug");
constexpr const int &C = B;
static_assert(&A == &C, "Bug");
int main() { return 0; }
It is perfectly accepted by clang version 3.3, whereas g++ (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388 refuses it with:
bug2.cpp:5:1: error: non-constant condition for static assertion
static_assert(&A == &B, "Bug");
^
bug2.cpp:5: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;
^
It seems to me that GCC is correct (whereas I certainly would prefer clang behavior). Trying to read the standard I realized that I'm not enough of a language lawyer to decide. Can anyone confirm that?