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++/82685] basic_string_view<char> operator""sv(const char*, size_t) should be noexcept


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)
    ^

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