This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/82685] basic_string_view<char> operator""sv(const char*, size_t) should be noexcept
- From: "pavel.kryukov at phystech dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Oct 2017 05:52:31 +0000
- Subject: [Bug libstdc++/82685] basic_string_view<char> operator""sv(const char*, size_t) should be noexcept
- Auto-submitted: auto-generated
- References: <bug-82685-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82685
--- Comment #3 from Pavel I. Kryukov <pavel.kryukov at phystech dot edu> ---
I faced the problem because Clang-Tidy warns about possible uncaught exception
if I initialize a global static string_view variable.
It seems that Clang-Tidy simply checks whether `noexcept` is specified, is it a
Clang-Tidy problem then?
Command line output:
clang-tidy-5.0 -checks=cert-err58-cpp gcc_string_view.cpp -- --std=c++17
1 warning generated.
/mnt/d/Dev/gcc_string_view.cpp:5:18: warning: initialization of 'my_variable'
with static storage duration may throw an
exception that cannot be caught [cert-err58-cpp]
std::string_view my_variable = "my_string"sv;
^
/usr/lib/gcc/x86_64-linux-gnu/7.1.0/../../../../include/c++/7.1.0/string_view:646:5:
note: possibly throwing function de
clared here
operator""sv(const char* __str, size_t __len)
^