std::exception_ptr declared as type alias in libstdc++
libstdc++ now declares std::exception_ptr as a type alias, matching the C++ standard and improving reflection capabilities.
The C++ standard specifies std::exception_ptr as a type alias. This change modifies libstdc++ to use a type alias declaration instead of a using-declaration, aligning with the standard. This change is observable via reflection and ensures continued support for std::exception_ptr as an extension in C++98 mode.
In Details
This commit changes the definition of std::exception_ptr in libstdc++ from a using-declaration to a typedef-declaration (aliased as type alias). This aligns with the C++ standard's specification in [propagation]. The change is observable via reflection, as demonstrated by a new test case, and preserves C++98 compatibility for this extension.
- type alias
- In C++, a type alias is a name that can be used as an alternative to another type. C++11 introduced
usingfor type aliases, which is more flexible thantypedefbut achieves similar goals. The standard specifiesstd::exception_ptras a type alias. - reflection
- In programming, reflection is the ability of a program to examine, introspect, and modify its own structure and behavior at runtime. In C++, this can involve inspecting type information.
- using-declaration
- A
usingdeclaration in C++ brings names from a namespace into the current scope. In this context,using std::exception_ptrwould make the name available in thestdnamespace.