diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc
index 38a4cdd86de..7bbc53f9729 100644
--- a/gcc/cp/reflect.cc
+++ b/gcc/cp/reflect.cc
@@ -2781,13 +2781,7 @@ eval_is_noexcept (tree r)
if (eval_is_function (r) == boolean_true_node)
{
r = maybe_get_reflection_fndecl (r);
- if (TREE_CODE (r) == FUNCTION_DECL
- && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (r))
- {
- bool no_err = maybe_instantiate_noexcept (r);
- gcc_assert (no_err);
- }
-
+ maybe_instantiate_noexcept (r);
if (TYPE_NOTHROW_P (TREE_TYPE (r)))
return boolean_true_node;
else
diff --git a/gcc/testsuite/g++.dg/reflect/is_noexcept4.C b/gcc/testsuite/g++.dg/reflect/is_noexcept4.C
index 02b86e2814e..9b4b2b892ca 100644
--- a/gcc/testsuite/g++.dg/reflect/is_noexcept4.C
+++ b/gcc/testsuite/g++.dg/reflect/is_noexcept4.C
@@ -1,6 +1,6 @@
// { dg-do compile { target c++26 } }
// { dg-additional-options "-freflection" }
-// Test std::meta::is_deleted.
+// Test std::meta::is_noexcept.
#include
#include
@@ -15,7 +15,7 @@ struct Mem {
Mem& operator=(Mem const&) noexcept(Noex);
Mem& operator=(Mem&&) noexcept(Noex);
~Mem() noexcept(Noex);
-
+
bool operator==(const Mem&) const noexcept(Noex);
std::strong_ordering operator<=>(const Mem&) const noexcept(Noex);
};
@@ -38,25 +38,24 @@ struct ExplicitDef
ExplicitDef& operator=(const ExplicitDef&) = default;
ExplicitDef& operator=(ExplicitDef&&) = default;
-
+
~ExplicitDef() = default;
Mem d;
};
-// FIXME crashes here.
-// static_assert (is_noexcept (select_mem (^^ExplicitDef, is_default_constructor)));
-// static_assert (is_noexcept (select_mem (^^ExplicitDef, is_copy_constructor)));
-// static_assert (is_noexcept (select_mem (^^ExplicitDef, is_move_constructor)));
-// static_assert (is_noexcept (select_mem (^^ExplicitDef, is_copy_assignment)));
-// static_assert (is_noexcept (select_mem (^^ExplicitDef, is_move_assignment)));
+static_assert (is_noexcept (select_mem (^^ExplicitDef, is_default_constructor)));
+static_assert (is_noexcept (select_mem (^^ExplicitDef, is_copy_constructor)));
+static_assert (is_noexcept (select_mem (^^ExplicitDef, is_move_constructor)));
+static_assert (is_noexcept (select_mem (^^ExplicitDef, is_copy_assignment)));
+static_assert (is_noexcept (select_mem (^^ExplicitDef, is_move_assignment)));
static_assert (is_noexcept (select_mem (^^ExplicitDef, is_destructor)));
-// static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_default_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_copy_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_move_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_copy_assignment)));
-// static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_move_assignment)));
+static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_default_constructor)));
+static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_copy_constructor)));
+static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_move_constructor)));
+static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_copy_assignment)));
+static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_move_assignment)));
static_assert (!is_noexcept (select_mem (^^ExplicitDef, is_destructor)));
template
@@ -65,18 +64,18 @@ struct ImplicitDef
Mem d;
};
-// static_assert (is_noexcept (select_mem (^^ImplicitDef, is_default_constructor)));
-// static_assert (is_noexcept (select_mem (^^ImplicitDef, is_copy_constructor)));
-// static_assert (is_noexcept (select_mem (^^ImplicitDef, is_move_constructor)));
-// static_assert (is_noexcept (select_mem (^^ImplicitDef, is_copy_assignment)));
-// static_assert (is_noexcept (select_mem (^^ImplicitDef, is_move_assignment)));
+static_assert (is_noexcept (select_mem (^^ImplicitDef, is_default_constructor)));
+static_assert (is_noexcept (select_mem (^^ImplicitDef, is_copy_constructor)));
+static_assert (is_noexcept (select_mem (^^ImplicitDef, is_move_constructor)));
+static_assert (is_noexcept (select_mem (^^ImplicitDef, is_copy_assignment)));
+static_assert (is_noexcept (select_mem (^^ImplicitDef, is_move_assignment)));
static_assert (is_noexcept (select_mem (^^ImplicitDef, is_destructor)));
-// static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_default_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_copy_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_move_constructor)));
-// static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_copy_assignment)));
-// static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_move_assignment)));
+static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_default_constructor)));
+static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_copy_constructor)));
+static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_move_constructor)));
+static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_copy_assignment)));
+static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_move_assignment)));
static_assert (!is_noexcept (select_mem (^^ImplicitDef, is_destructor)));
template
@@ -84,12 +83,11 @@ struct ExplicitRelOps
{
bool operator==(const ExplicitRelOps&) const = default;
auto operator<=>(const ExplicitRelOps&) const = default;
-
+
Mem d;
};
-// FIXME requires operator== and operator<=> to be used
-static_assert (!is_noexcept (^^ExplicitRelOps::operator==));
-static_assert (!is_noexcept (^^ExplicitRelOps::operator<=>));
+static_assert (is_noexcept (^^ExplicitRelOps::operator==));
+static_assert (is_noexcept (^^ExplicitRelOps::operator<=>));
ExplicitRelOps x1;
static_assert (noexcept (x1 == x1));
@@ -105,13 +103,12 @@ struct ImplicitRelOps
{
// operator== is implicitly declared
auto operator<=>(const ImplicitRelOps&) const = default;
-
+
Mem d;
};
-// FIXME requires operator== and operator<=> to be used
-static_assert (!is_noexcept (^^ImplicitRelOps::operator==));
-static_assert (!is_noexcept (^^ImplicitRelOps::operator<=>));
+static_assert (is_noexcept (^^ImplicitRelOps::operator==));
+static_assert (is_noexcept (^^ImplicitRelOps::operator<=>));
ImplicitRelOps x2;
static_assert (noexcept (x2 == x2));
@@ -121,4 +118,3 @@ static_assert (is_noexcept (^^ImplicitRelOps::operator<=>));
static_assert (!is_noexcept (^^ImplicitRelOps::operator==));
static_assert (!is_noexcept (^^ImplicitRelOps::operator<=>));
-