Commit 95f2fd9c by Jonathan Wakely Committed by Jonathan Wakely

nested_exception.h: Do not try to derive from final classes.

	* libsupc++/nested_exception.h: Do not try to derive from final
	classes.
	* testsuite/18_support/nested_exception/throw_with_nested.cc: Test
	final class.

From-SVN: r221476
parent 076d86f3
2015-03-17 Jonathan Wakely <jwakely@redhat.com>
* libsupc++/nested_exception.h: Do not try to derive from final
classes.
* testsuite/18_support/nested_exception/throw_with_nested.cc: Test
final class.
2015-03-13 Jonathan Wakely <jwakely@redhat.com> 2015-03-13 Jonathan Wakely <jwakely@redhat.com>
* acinclude.m4: Make --enable-libstdcxx-time=auto work for dragonfly. * acinclude.m4: Make --enable-libstdcxx-time=auto work for dragonfly.
......
...@@ -108,7 +108,7 @@ namespace std ...@@ -108,7 +108,7 @@ namespace std
{ throw static_cast<_Up&&>(__t); } { throw static_cast<_Up&&>(__t); }
}; };
template<typename _Tp, bool = __is_class(_Tp)> template<typename _Tp, bool = __is_class(_Tp) && !__is_final(_Tp)>
struct _Throw_with_nested_helper : _Throw_with_nested_impl<_Tp> struct _Throw_with_nested_helper : _Throw_with_nested_impl<_Tp>
{ }; { };
......
...@@ -26,6 +26,8 @@ struct derived : std::nested_exception { }; ...@@ -26,6 +26,8 @@ struct derived : std::nested_exception { };
struct not_derived { virtual ~not_derived() noexcept; }; struct not_derived { virtual ~not_derived() noexcept; };
inline not_derived::~not_derived() noexcept = default; inline not_derived::~not_derived() noexcept = default;
struct uninheritable final { };
void test01() void test01()
{ {
bool test __attribute__((unused)) = false; bool test __attribute__((unused)) = false;
...@@ -72,9 +74,29 @@ void test02() ...@@ -72,9 +74,29 @@ void test02()
VERIFY( test ); VERIFY( test );
} }
void test03()
{
bool test __attribute__((unused)) = false;
try
{
std::throw_with_nested(uninheritable());
}
catch (const std::nested_exception&)
{
VERIFY( false );
}
catch(const uninheritable&)
{
test = true;
}
VERIFY( test );
}
int main() int main()
{ {
test01(); test01();
test02(); test02();
test03();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment