https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79114
Bug ID: 79114
Summary: [6/7 Regression] std::throw_with_nested("string
literal") is rejected
Product: gcc
Version: 6.3.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <exception>
int main() { std::throw_with_nested("string literal"); }
In file included from /usr/include/c++/6.3.1/exception:171:0,
from ex.cc:1:
/usr/include/c++/6.3.1/bits/nested_exception.h: In instantiation of ‘void
std::throw_with_nested(_Tp&&) [with _Tp = const char (&)[15]]’:
ex.cc:2:53: required from here
/usr/include/c++/6.3.1/bits/nested_exception.h:121:7: error: static assertion
failed: throw_with_nested argument must be CopyConstructible
static_assert(_CopyConstructible::value,
^~~~~~~~~~~~~
I added the static assertion because the standard says that's what's required,
but it seems to be a defect in the standard because it doesn't work with the
example above. I'm reporting a defect, and will relax the assertion.