[Bug c++/107735] Inconsistent error messages for std::array out of bound due to taking the address of one-past-the-end is valid

2022-11-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107735 --- Comment #4 from Andrew Pinski --- (In reply to Jonathan Wakely from comment #3) > (In reply to Andrew Pinski from comment #2) > > I wonder if this is because doing > > constexpr const int *v1 = &array[3]; > > > > is valid and well defined.

[Bug c++/107735] Inconsistent error messages for std::array out of bound due to taking the address of one-past-the-end is valid

2022-11-17 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107735 --- Comment #3 from Jonathan Wakely --- (In reply to Andrew Pinski from comment #2) > I wonder if this is because doing > constexpr const int *v1 = &array[3]; > > is valid and well defined. It's not, but &array.data()[3] is. I agree that's p

[Bug c++/107735] Inconsistent error messages for std::array out of bound

2022-11-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107735 --- Comment #2 from Andrew Pinski --- I wonder if this is because doing constexpr const int *v1 = &array[3]; is valid and well defined. Even clang gives two different error messages: :3:21: error: constexpr variable 'v1' must be initialized b

[Bug c++/107735] Inconsistent error messages for std::array out of bound

2022-11-17 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107735 Jonathan Wakely changed: What|Removed |Added Last reconfirmed||2022-11-17 Status|UNCONFI