BINDING_SLOTS_FIXED = BINDING_SLOT_GLOBAL + 1
};
-/* Create an overload suitable for recording an artificial TYPE_DECL
- and another decl. We use this machanism to implement the struct
- stat hack. */
-
-#define STAT_HACK_P(N) ((N) && TREE_CODE (N) == OVERLOAD && OVL_LOOKUP_P (N))
-#define STAT_TYPE_VISIBLE_P(N) TREE_USED (OVERLOAD_CHECK (N))
-#define STAT_TYPE(N) TREE_TYPE (N)
-#define STAT_DECL(N) OVL_FUNCTION (N)
-#define STAT_VISIBLE(N) OVL_CHAIN (N)
-#define MAYBE_STAT_DECL(N) (STAT_HACK_P (N) ? STAT_DECL (N) : N)
-#define MAYBE_STAT_TYPE(N) (STAT_HACK_P (N) ? STAT_TYPE (N) : NULL_TREE)
-
-/* When a STAT_HACK_P is true, OVL_USING_P and OVL_EXPORT_P are valid
- and apply to the hacked type. */
-
-/* For regular (maybe) overloaded functions, we have OVL_HIDDEN_P.
- But we also need to indicate hiddenness on implicit type decls
- (injected friend classes), and (coming soon) decls injected from
- block-scope externs. It is too awkward to press the existing
- overload marking for that. If we have a hidden non-function, we
- always create a STAT_HACK, and use these two markers as needed. */
-#define STAT_TYPE_HIDDEN_P(N) OVL_HIDDEN_P (N)
-#define STAT_DECL_HIDDEN_P(N) OVL_DEDUP_P (N)
-
/* Create a STAT_HACK node with DECL as the value binding and TYPE as
the type binding. */
value and type slots are both filled and both hidden. */
#define HIDDEN_TYPE_BINDING_P(NODE) ((NODE)->type_is_hidden)
+/* Create an overload suitable for recording an artificial TYPE_DECL
+ and another decl. We use this machanism to implement the struct
+ stat hack. */
+
+#define STAT_HACK_P(N) ((N) && TREE_CODE (N) == OVERLOAD && OVL_LOOKUP_P (N))
+#define STAT_TYPE_VISIBLE_P(N) TREE_USED (OVERLOAD_CHECK (N))
+#define STAT_TYPE(N) TREE_TYPE (N)
+#define STAT_DECL(N) OVL_FUNCTION (N)
+#define STAT_VISIBLE(N) OVL_CHAIN (N)
+#define MAYBE_STAT_DECL(N) (STAT_HACK_P (N) ? STAT_DECL (N) : N)
+#define MAYBE_STAT_TYPE(N) (STAT_HACK_P (N) ? STAT_TYPE (N) : NULL_TREE)
+
+/* When a STAT_HACK_P is true, OVL_USING_P and OVL_EXPORT_P are valid
+ and apply to the hacked type. */
+
+/* For regular (maybe) overloaded functions, we have OVL_HIDDEN_P.
+ But we also need to indicate hiddenness on implicit type decls
+ (injected friend classes), and (coming soon) decls injected from
+ block-scope externs. It is too awkward to press the existing
+ overload marking for that. If we have a hidden non-function, we
+ always create a STAT_HACK, and use these two markers as needed. */
+#define STAT_TYPE_HIDDEN_P(N) OVL_HIDDEN_P (N)
+#define STAT_DECL_HIDDEN_P(N) OVL_DEDUP_P (N)
+
/* Datatype that represents binding established by a declaration between
a name and a C++ entity. */
struct GTY(()) cxx_binding {
hash_set<tree> *seen = nullptr;
for (tree o : *DECL_NAMESPACE_BINDINGS (ns))
{
- if (TREE_CODE (o) == OVERLOAD && OVL_LOOKUP_P (o))
+ if (STAT_HACK_P (o))
{
- if (TREE_TYPE (o))
+ if (STAT_TYPE (o) && !STAT_TYPE_HIDDEN_P (o))
{
- tree m = TREE_TYPE (TREE_TYPE (o));
+ tree m = TREE_TYPE (STAT_TYPE (o));
if (members_of_representable_p (ns, m))
CONSTRUCTOR_APPEND_ELT (elts, NULL_TREE,
get_reflection_raw (loc, m));
}
- if (OVL_DEDUP_P (o) || !OVL_FUNCTION (o))
+ if (STAT_DECL_HIDDEN_P (o) || !STAT_DECL (o))
continue;
- o = OVL_FUNCTION (o);
+ o = STAT_DECL (o);
}
for (ovl_iterator iter (o); iter; ++iter)
{
--- /dev/null
+// PR c++/123641
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+// Test that we skip STAT_TYPE_HIDDEN_P.
+
+#include <meta>
+using namespace std::meta;
+
+namespace N {
+ void B ();
+ struct A {
+ int m;
+ friend class B;
+ };
+}
+constexpr access_context uctx = access_context::unchecked ();
+static_assert (members_of (^^N, uctx).size () == 2);