[Bug libstdc++/103879] error: accessing value of variant::_Copy_ctor_base through a 'const variant<string>' glvalue in a constant expression
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 31 22:10:05 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103879
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang rejects it also (with their libc++):
<source>:10:5: error: variable of non-literal type 'S' cannot be defined in a
constexpr function
S s{"str"};
^
<source>:6:29: note: 'S' is not literal because it has data member 'v' of
non-literal type 'std::variant<std::string>' (aka 'variant<basic_string<char,
char_traits<char>, allocator<char>>>')
std::variant<std::string> v;
^
More information about the Gcc-bugs
mailing list