https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124057

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC is correct. That constructor is only valid for temporaries.

#include <span>
#include<initializer_list>

consteval int f(std::span<const int> s) { return s.size(); }

int main() {
     constexpr int n = f({0,0}); // accepted as of c++26 p2447
     static_assert(n == 2);
}

Your example forms a dangling pointer.

Reply via email to