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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.2

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Using __builtin_unreachable works, and the diagnostic seems acceptable:

In file included from /home/jwakely/gcc/12/include/c++/12.0.0/iosfwd:38,
                 from /home/jwakely/gcc/12/include/c++/12.0.0/string_view:40,
                 from sv.C:1:
sv.C:5:21:   in 'constexpr' expansion of 'f()'
sv.C:3:56:   in 'constexpr' expansion of
's.std::basic_string_view<char>::front()'
/home/jwakely/gcc/12/include/c++/12.0.0/string_view:251:9: error:
'__builtin_unreachable()' is not a constant expression
  251 |         __glibcxx_assert(this->_M_len > 0);
      |         ^~~~~~~~~~~~~~~~

Reply via email to