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 libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str)


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

            Bug ID: 68133
           Summary: constexpr basic_string_view(const _CharT* __str)
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d.v.a at ngs dot ru
  Target Milestone: ---

Compilation of this code:

#include<experimental/string_view>

int main()
{
    int arr[std::experimental::string_view("s").length()];
}

produces error:

error: ISO C++ forbids variable length array 'arr' [-Wvla]


Constructor's implementation:

      constexpr basic_string_view(const _CharT* __str)
      : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
        _M_str{__str}
      { }

But traits_type::length() isn't constexpr


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