Skip to content
Snippets Groups Projects
Commit a8c7c3a4 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Move test error_category to global scope

A recent GDB change causes this test to fail due to missing RTTI for the
custom_cast type. This is presumably because the custom_cat type was
defined as a local class, so has no linkage. Moving it to local scope
seems to fix the test regressions, and probably makes the test more
realistic as a local class with no linkage isn't practical to use as an
error category that almost certainly needs to be referred to in other
scopes.

libstdc++-v3/ChangeLog:

	* testsuite/libstdc++-prettyprinters/cxx11.cc: Move custom_cat
	to namespace scope.
parent 45a3ee8a
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,11 @@ struct datum ...@@ -63,6 +63,11 @@ struct datum
std::unique_ptr<datum> global; std::unique_ptr<datum> global;
struct custom_cat : std::error_category {
const char* name() const noexcept { return "miaow"; }
std::string message(int) const { return ""; }
};
int int
main() main()
{ {
...@@ -179,10 +184,7 @@ main() ...@@ -179,10 +184,7 @@ main()
std::error_condition ecinval = std::make_error_condition(std::errc::invalid_argument); std::error_condition ecinval = std::make_error_condition(std::errc::invalid_argument);
// { dg-final { note-test ecinval {std::error_condition = {"generic": EINVAL}} } } // { dg-final { note-test ecinval {std::error_condition = {"generic": EINVAL}} } }
struct custom_cat : std::error_category { custom_cat cat;
const char* name() const noexcept { return "miaow"; }
std::string message(int) const { return ""; }
} cat;
std::error_code emiaow(42, cat); std::error_code emiaow(42, cat);
// { dg-final { note-test emiaow {std::error_code = {custom_cat: 42}} } } // { dg-final { note-test emiaow {std::error_code = {custom_cat: 42}} } }
std::error_condition ecmiaow(42, cat); std::error_condition ecmiaow(42, cat);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment