SPLICE_EXPR_MEMBER_ACCESS_P (t),
(complain & tf_error)))
return error_mark_node;
+
+ if (SPLICE_EXPR_ADDRESS_P (t))
+ {
+ if (BASELINK_P (op))
+ op = build_offset_ref (BINFO_TYPE (BASELINK_ACCESS_BINFO (op)), op,
+ /*address_p=*/true, complain);
+ else if (DECL_NONSTATIC_MEMBER_P (op))
+ op = build_offset_ref (DECL_CONTEXT (op), op,
+ /*address_p=*/true, complain);
+ }
+
if (outer_automatic_var_p (op))
op = process_outer_var_ref (op, complain);
/* Like in cp_parser_splice_expression, for foo.[: bar :]
--- /dev/null
+// PR c++/123660
+// PR c++/123661
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+#include <meta>
+
+struct s {
+ int get_z(this s) { return 4; }
+ static int get_y() { return 4; }
+ int get_x() { return 3; }
+ int xx;
+ static int xxx;
+};
+
+int s::xxx = 5;
+
+template<typename T, decltype(0uz) I>
+constexpr auto test() {
+ constexpr auto ctx = std::meta::access_context::current();
+ return &[:members_of(^^T, ctx)[I]:];
+}
+
+static_assert(test<s, 0uz>() == &s::get_z);
+static_assert(test<s, 1uz>() == &s::get_y);
+static_assert(test<s, 2uz>() == &s::get_x);
+static_assert(test<s, 3uz>() == &s::xx);
+static_assert(test<s, 4uz>() == &s::xxx);
--- /dev/null
+// PR c++/123660
+// PR c++/123661
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+#include <meta>
+
+void f() {}
+struct s {
+ int get_z(this s) { return 4; }
+ static int get_y() { return 4; }
+ int get_x() { return 3; }
+ int xx;
+ static int xxx;
+};
+
+int s::xxx = 5;
+
+template<std::meta::info refl_expr>
+constexpr auto test() {
+ return &[:refl_expr:];
+}
+
+static_assert(test<^^s::get_z>() == &s::get_z);
+static_assert(test<^^s::get_y>() == &s::get_y);
+static_assert(test<^^s::get_x>() == &s::get_x);
+static_assert(test<^^s::xx>() == &s::xx);
+static_assert(test<^^s::xxx>() == &s::xxx);
+static_assert(test<^^f>() == &f);