r = maybe_get_first_fn (r);
vec<constructor_elt, va_gc> *elts = nullptr;
- tree args = (TREE_CODE (r) == FUNCTION_DECL
- ? FUNCTION_FIRST_USER_PARM (r)
- : TYPE_ARG_TYPES (r));
- for (tree arg = args; arg && arg != void_list_node; arg = TREE_CHAIN (arg))
- CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
- get_reflection_raw (loc, arg, REFLECT_PARM));
+ if (TREE_CODE (r) == FUNCTION_DECL)
+ for (tree arg = FUNCTION_FIRST_USER_PARM (r); arg; arg = DECL_CHAIN (arg))
+ CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
+ get_reflection_raw (loc, arg, REFLECT_PARM));
+ else
+ for (tree arg = TYPE_ARG_TYPES (r); arg && arg != void_list_node;
+ arg = TREE_CHAIN (arg))
+ {
+ tree type = maybe_strip_typedefs (TREE_VALUE (arg));
+ CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
+ get_reflection_raw (loc, type));
+ }
return get_vector_of_info_elts (elts);
}
--- /dev/null
+// PR c++/123913
+// PR c++/123964
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+#include <meta>
+
+using I = long;
+void foo (int, I) {}
+using bar = void (int, I);
+
+constexpr auto a = std::meta::reflect_constant_array (parameters_of (^^foo));
+constexpr auto b = std::meta::reflect_constant_array (parameters_of (^^bar));
+static_assert (is_function_parameter (parameters_of (^^foo)[0]));
+static_assert (is_function_parameter (parameters_of (^^foo)[1]));
+static_assert (parameters_of (^^bar)[0] == ^^int);
+static_assert (parameters_of (^^bar)[1] == ^^long);