mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-21 19:35:36 -05:00
Tweak what() for return_type_of
This commit is contained in:
@@ -3074,7 +3074,9 @@ eval_return_type_of (location_t loc, const constexpr_ctx *ctx, tree r,
|
||||
{
|
||||
if ((eval_is_function (r) != boolean_true_node || !has_type (r, kind))
|
||||
&& eval_is_function_type (r) != boolean_true_node)
|
||||
return throw_exception_nofn (loc, ctx, fun, non_constant_p, jump_target);
|
||||
return throw_exception (loc, ctx, "reflection does not represent a "
|
||||
"function or function type with a return type",
|
||||
fun, non_constant_p, jump_target);
|
||||
|
||||
r = MAYBE_BASELINK_FUNCTIONS (r);
|
||||
if (TREE_CODE (r) == FUNCTION_DECL)
|
||||
|
||||
20
gcc/testsuite/g++.dg/reflect/return_type_of2.C
Normal file
20
gcc/testsuite/g++.dg/reflect/return_type_of2.C
Normal file
@@ -0,0 +1,20 @@
|
||||
// { dg-do compile { target c++26 } }
|
||||
// { dg-additional-options "-freflection" }
|
||||
// Test std::meta::return_type_of.
|
||||
|
||||
#include <meta>
|
||||
|
||||
using namespace std::meta;
|
||||
|
||||
struct S {
|
||||
S () {
|
||||
int a;
|
||||
constexpr auto r = return_type_of (type_of (parent_of (^^a))); // { dg-error "does not have a type" }
|
||||
constexpr auto t = return_type_of (parent_of (^^a)); // { dg-error "function or function type with a return type" }
|
||||
}
|
||||
~S () {
|
||||
int a;
|
||||
constexpr auto r = return_type_of (type_of (parent_of (^^a))); // { dg-error "does not have a type" }
|
||||
constexpr auto t = return_type_of (parent_of (^^a)); // { dg-error "function or function type with a return type" }
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user