The standard specifies this in [propagation]:
using exception_ptr = _unspecified_;
We instead define it with a using-declaration that pulls
std::__exception_ptr::exception_ptr into namespace std. The difference
is observable using reflection, as in the new test.
This changes the declaration of std::exception_ptr to be a
typedef-declaration instead of a using-declaration. That's equivalent to
an alias-declaration for the purposes of reflection, and preserves our
support for std::exception_ptr as an extension in C++98 mode.
libstdc++-v3/ChangeLog:
* libsupc++/exception_ptr.h (exception_ptr): Declare as type
alias not via using-declaration.
* testsuite/18_support/exception_ptr/meta.cc: New test.
---
Tested 18_support/exception_ptr/* and running the rest of the tests now
on x86_64-linux.
This should be pushed to the gcc-16 branch too.
libstdc++-v3/libsupc++/exception_ptr.h | 2 +-
.../testsuite/18_support/exception_ptr/meta.cc | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 libstdc++-v3/testsuite/18_support/exception_ptr/meta.cc
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h
b/libstdc++-v3/libsupc++/exception_ptr.h
index 81efe49be1fc..ab34f4e634fa 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -67,7 +67,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
class exception_ptr;
}
- using __exception_ptr::exception_ptr;
+ typedef __exception_ptr::exception_ptr exception_ptr;
/** Obtain an exception_ptr to the currently handled exception.
*
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/meta.cc
b/libstdc++-v3/testsuite/18_support/exception_ptr/meta.cc
new file mode 100644
index 000000000000..be228c20c3d0
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/meta.cc
@@ -0,0 +1,15 @@
+// { dg-options "-freflection" }
+// { dg-do compile { target c++26 } }
+// { dg-require-effective-target cxx11_abi }
+
+#include <exception>
+#include <meta>
+
+consteval bool test_exception_ptr_is_type_alias()
+{
+ auto exptr = ^^std::exception_ptr;
+ return std::meta::is_type_alias(exptr)
+ && std::meta::dealias(exptr) == ^^decltype(std::current_exception());
+}
+
+static_assert( test_exception_ptr_is_type_alias() );
--
2.56.0