This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str)
- From: "d.v.a at ngs dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Oct 2015 11:58:31 +0000
- Subject: [Bug libstdc++/68133] New: constexpr basic_string_view(const _CharT* __str)
- Auto-submitted: auto-generated
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