https://bugs.llvm.org/show_bug.cgi?id=39108
Bug ID: 39108
Summary: constexpr std::string_view global no longer compiles
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: jorg.br...@gmail.com
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
clang 7.0 accepted global variables of type std::string_view, even if declared
constexpr.
The current trunk of clang (clang version 8.0.0 (trunk 343155) ) does not.
For that matter, std::string::traits_type::length also does not.
Repro: this compiles under 7.0 but not 8.0.0 / trunk 343155:
#include <string>
constexpr size_t one = std::string::traits_type::length("1");
size_t return_1() { return one; }
Giving this error:
<source>:3:18: error: constexpr variable 'one' must be initialized by a
constant expression
constexpr size_t one = std::string::traits_type::length("1");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:3:24: note: non-constexpr function 'length' cannot be used in a
constant expression
constexpr size_t one = std::string::traits_type::length("1");
^
/opt/compiler-explorer/gcc-7.2.0/lib/gcc/x86_64-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/char_traits.h:268:7:
note: declared here
length(const char_type* __s)
^
Obligatory godbolt link: https://gcc.godbolt.org/z/yOmaJr
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs