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

            Bug ID: 91488
           Summary: [9/10 Regression] char_traits::length causes "inlining
                    failed in call to always_inline" error with -fgnu-tm
                    -O2 -std=c++17
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Repro (https://gcc.godbolt.org/z/RO-2Ec):

#include <string>

int main() {
    auto z = std::char_traits<char>::length("");
}

$ g++ -fgnu-tm -O2 -std=c++17

In file included from
/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/string:40,

                 from <source>:1:

/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/bits/char_traits.h:
In static member function 'static constexpr std::size_t
std::char_traits<char>::length(const char_type*)':

/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/bits/char_traits.h:231:5:
error: inlining failed in call to 'always_inline' 'constexpr bool
std::__constant_string_p(const _CharT*) [with _CharT = char]': 

  231 |     __constant_string_p(const _CharT* __s)

      |     ^~~~~~~~~~~~~~~~~~~

/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/bits/char_traits.h:332:25:
note: called from here

  332 |  if (__constant_string_p(__s))

      |      ~~~~~~~~~~~~~~~~~~~^~~~~

/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/bits/char_traits.h:231:5:
error: inlining failed in call to 'always_inline' 'constexpr bool
std::__constant_string_p(const _CharT*) [with _CharT = char]': 

  231 |     __constant_string_p(const _CharT* __s)

      |     ^~~~~~~~~~~~~~~~~~~

/opt/compiler-explorer/gcc-trunk-20190818/include/c++/10.0.0/bits/char_traits.h:332:25:
note: called from here

  332 |  if (__constant_string_p(__s))

      |      ~~~~~~~~~~~~~~~~~~~^~~~~

Reply via email to