This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65398] [5 Regression] [C++11] GCC rejects constexpr variable definitions with valid initialization
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Mar 2015 07:40:33 +0000
- Subject: [Bug c++/65398] [5 Regression] [C++11] GCC rejects constexpr variable definitions with valid initialization
- Auto-submitted: auto-generated
- References: <bug-65398-4 at http dot gcc dot gnu dot org/bugzilla/>
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.