[Bug c++/65398] [5 Regression] [C++11] GCC rejects constexpr variable definitions with valid initialization
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 30 08:59:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65398
--- Comment #7 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Mitsuru Kariya from comment #6)
> I think that it should either
>
> 1) cause a compilation error at the definition of the eq1 if the result of
> "&s1[sizeof(s1)] == &s2[0]" is "unspecified".
>
> or
>
> 2) output "true, true" because both the "&s1[sizeof(s1)]" and "&s2[0]"
> represent the same address.
>
> but I am not sure which behavior is appropriate.
>
> (I cannot find an explicit description by which comparison between one past
> the end pointer and another object's pointer is "unspecified behavior", in
> the C++ standard.)
According to the current resolution of CWG 1652,
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1652
this comparison should be considered as unspecified and the code should be
rejected.
More information about the Gcc-bugs
mailing list