P3385R7 — Attributes reflection (16 items) EWG, LEWG
Aurelien Cassagnes
This paper proposes extending C++ reflection to support attributes by introducing a reflect-expression of the form ^^[[attribute]] and new metafunctions including attributes_of, has_attribute, and is_attribute in the header. It enables generic code to introspect attributes appertaining to entities, compare attribute reflections for equality, and use attribute reflections to attach attributes to synthesized data members via define_aggregate. The proposal scopes support to standard attributes with simple argument clauses and optionally vendor-specific attributes, while leaving unsupported or unknown attributes ill-formed to reflect.

References — Anthropic Citations API

[1]
"Here we have 2 attributes showing up in `alignas` and `[[no_unique_adress]]`."
[2]
"there is new attributes being added to the language somewhat regularly."
[3]
"Standard attributes with `conditional-expression` argument are **unsupported** ((e.g, `[[assume]]`)."
[4] chars 43143–44958
"The current practice around creating reflection of problematic constructs (such as using-declarator) is to be..."
[4] chars 43143–44958
"The current practice around creating reflection of problematic constructs (such as using-declarator) is to be..."
[5] chars 43143–44958
"The current practice around creating reflection of problematic constructs (such as using-declarator) is to be..."
[5] chars 43143–44958
"The current practice around creating reflection of problematic constructs (such as using-declarator) is to be..."
[6]
"In the case where an entity is legally redeclared with different attribute arguments, `attribute_of` return one of those."
[7]
"In the case where an entity is legally redeclared with different attribute arguments, `attribute_of` return one of those."
[8]
"static_assert(identifier_of(^^[[clang::warn_unused_result("message")]] == "clang::warn_unused_result")); // true"
[9]
"static_assert(identifier_of(^^[[nodiscard("message")]] == "nodiscard")); // true"
[10]
"consteval string_view u8identifier_of(info r);"
[11]
"For an attribute `r` non described in this document, computing the reflection of `r` is ill-formed"
[12]
"A `reflect-expression` of the form `^^[[ attribute ]]` for attribute described in this document [dcl.attr], represents said attribute."
[13]
"r₁ and r₂ are identical if their `attribute-token` are identical"
Summary: P3385R7 proposes extending the P2996 reflection framework to cover C++ attributes, introducing attributes_of, identifier_of, and related metafunctions that let users reflect on standard and vendor attributes at compile time. Thirteen findings were identified spanning misparenthesized code examples, identifier misspellings, grammar errors in proposed normative wording, and a wrong return type in the wording diff base.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.