This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/65398] [5 Regression] [C++11] GCC rejects constexpr variable definitions with valid initialization


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]