https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80265
janisozaur+gcc at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janisozaur+gcc at gmail dot com --- Comment #37 from janisozaur+gcc at gmail dot com --- Hi, I ran into what I think is a variant of this bug. Here's the problem presented with godbolt: https://godbolt.org/z/SP-4uG And the contents of that link, as reproduced on my machine, are: #include <string_view> #include <cwchar> static const std::wstring_view foo = L"foo"; static constexpr std::wstring_view bar = L"bar"; $ g++ --version g++ (GCC) 8.2.1 20181127 $ g++ -c test.cpp -Wall -Wextra -std=c++17 # exit code 0 $ gcc9/bin/g++ --version g++ (GCC) 9.0.1 20190225 (experimental) $ gcc9/bin/g++ -c test.cpp -Wall -Wextra -std=c++17 # exit code 0 $ clang++ --version clang version 7.0.1 (tags/RELEASE_701/final) $ clang++ -c -Wall -Wextra test.cpp -std=c++17 -Wno-unused-const-variable -stdlib=libc++ # exit code 0 $ clang++ -c -Wall -Wextra test.cpp -std=c++17 test.cpp:4:36: error: constexpr variable 'bar' must be initialized by a constant expression static constexpr std::wstring_view bar = L"bar"; ^ ~~~~~~ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/bits/char_traits.h:431:11: note: non-constexpr function 'wcslen' cannot be used in a constant expression return wcslen(__s); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/string_view:100:39: note: in call to 'length(&L"bar"[0])' : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, ^ test.cpp:4:42: note: in call to 'basic_string_view(&L"bar"[0])' static constexpr std::wstring_view bar = L"bar"; ^ 1 error generated. Relevant piece of code from libstdc++: https://github.com/gcc-mirror/gcc/blob/9fb89fa845c1b2e0a18d85ada0b077c84508ab78/libstdc%2B%2B-v3/include/bits/char_traits.h#L426-L431 Unfortunately, I can't really test clang with libstdc++ trunk. Please let me know if it is sufficient to leave this comment here or should I open another ticket?