Information technology — C++ extensions for reflection

This document describes extensions to the C++ Programming Language (Clause 2) that enable operations on source code. These extensions include new syntactic forms and modifications to existing language semantics, as well as changes and additions to the existing library facilities. Instructions to modify or add paragraphs are written as explicit instructions. Modifications made directly to existing text from ISO/IEC 14882:2020 use underlining to represent added text and strikethrough to represent deleted text.

Technologies de l'information — Extensions C++ pour la réflexion

General Information

Status
Published
Publication Date
10-Oct-2021
Current Stage
6060 - International Standard published
Start Date
11-Oct-2021
Due Date
04-Oct-2021
Completion Date
11-Oct-2021
Ref Project

Buy Standard

Technical specification
ISO/IEC TS 23619:2021 - Information technology -- C++ extensions for reflection
English language
46 pages
sale 15% off
Preview
sale 15% off
Preview
Draft
ISO/IEC PRF TS 23619:Version 14-avg-2021 - Information technology -- C++ Extensions for reflection
English language
46 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)

TECHNICAL ISO/IEC TS
SPECIFICATION 23619
First edition
2021-10
Information technology — C++
extensions for reflection
Technologies de l'information — Extensions C++ pour la réflexion
Reference number
ISO/IEC TS 23619:2021(E)
© ISO/IEC 2021

---------------------- Page: 1 ----------------------
ISO/IEC TS 23619:2021(E)
COPYRIGHT PROTECTED DOCUMENT
© ISO/IEC 2021
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on
the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below
or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii
 © ISO/IEC 2021 – All rights reserved

---------------------- Page: 2 ----------------------
ISO/IEC 23619:2021(E)
Contents
Foreword v
1 Scope 1
2 Normative references 2
3 Terms and definitions 3
4 General 4
4.1 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.2 Namespaces and headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.3 Feature-testing recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 Lexical conventions 5
5.12 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6 Basic concepts 6
6.2 One definition rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6.9 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7 Standard conversions 7
8 Expressions 8
8.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
8.2 Postfix expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
9 Statements 9
10 Declarations 10
10.1 Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
11 Declarators 14
11.1 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
12 Classes 15
13 Derived classes 16
14 Member access control 17
15 Special member functions 18
16 Overloading 19
17 Templates 20
17.6 Name resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
18 Exception handling 21
19 Preprocessing directives 22
©ISO/IEC 2021 – All rights reserved iii

---------------------- Page: 3 ----------------------
ISO/IEC 23619:2021(E)
20 Library introduction 23
20.6 Library-wide requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
21 Language support library 24
21.11 Static reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
A Compatibility 45
++
A.1 C extensions for Concepts with Reflection and ISO/IEC 14882:2020 . . . . . . . . . . 45
Index 46
©ISO/IEC 2021 – All rights reserved iv

---------------------- Page: 4 ----------------------
ISO/IEC 23619:2021(E)
Foreword [foreword]
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission)formthespecializedsystemforworldwidestandardization. Nationalbodiesthataremembers
of ISO or IEC participate in the development of International Standards through technical committees
established by the respective organization to deal with particular fields of technical activity. ISO and
IEC technical committees collaborate in fields of mutual interest. Other international organizations,
governmental and non-governmental, in liaison with ISO and IEC, also take part in the work.
The procedures used to develop this document and those intended for its further maintenance are described
in the ISO/IEC Directives, Part 1. In particular, the different approval criteria needed for the different
types of document should be noted. This document was drafted in accordance with the editorial rules of
the ISO/IEC Directives, Part 2 (see www.iso.org/directives or www.iec.ch/members_experts/refdocs).
Attention is drawn to the possibility that some of the elements of this document may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
Details of any patent rights identified during the development of the document will be in the Introduction
and/or on the ISO list of patent declarations received (see www.iso.org/patents) or the IEC list of patent
declarations received (see patents.iec.ch).
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation of the voluntary nature of standards, the meaning of ISO specific terms and expressions
related to conformity assessment, as well as information about ISO’s adherence to the World Trade Orga-
nization (WTO) principles in the Technical Barriers to Trade (TBT) see www.iso.org/iso/foreword.html.
In the IEC, see www.iec.ch/understanding-standards.
This document was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 22, Programming languages, their environments and system software interfaces.
Any feedback or questions on this document should be directed to the user’s national standards body. A
complete listing of these bodies can be found at www.iso.org/members.html and www.iec.ch/national-
committees.
©ISO/IEC 2021 – All rights reserved v

---------------------- Page: 5 ----------------------
ISO/IEC 23619:2021(E)
1 Scope [scope]
1
++
This document describes extensions to the C Programming Language (Clause 2) that enable operations
on source code. These extensions include new syntactic forms and modifications to existing language
semantics, as well as changes and additions to the existing library facilities.
2
Instructions to modify or add paragraphs are written as explicit instructions. Modifications made directly
to existing text from ISO/IEC 14882:2020 use underlining to represent added text and strikethrough to
represent deleted text.
©ISO/IEC 2021 – All rights reserved 1

---------------------- Page: 6 ----------------------
ISO/IEC 23619:2021(E)
2 Normative references [refs]
1
The following documents are referred to in the text in such a way that some or all of their content
constitutes requirements of this document. For dated references, only the edition cited applies. For
undated references, the latest edition of the referenced document (including any amendments) applies.
(1.1)
— ISO/IEC 14882:2020, Programming Languages — C++
(1.2)
— ISO/IEC TS 19217:2015, C++ Extensions for Concepts
©ISO/IEC 2021 – All rights reserved 2

---------------------- Page: 7 ----------------------
ISO/IEC 23619:2021(E)
3 Terms and definitions [defs]
1
No terms and definitions are listed in this document. ISO and IEC maintain terminological databases for
use in standardization at the following addresses:
(1.1)
— IEC Electropedia: available at https://www.electropedia.org/
(1.2)
— ISO Online browsing platform: available at https://www.iso.org/obp
©ISO/IEC 2021 – All rights reserved 3

---------------------- Page: 8 ----------------------
ISO/IEC 23619:2021(E)
4 General [general]
4.1 Implementation compliance [general.compliance]
1
Conformance requirements for this document are those defined in ISO/IEC 14882:2020, 4.1. Similarly, all
references to ISO/IEC 14882:2020 in the resulting document shall be taken as referring to the resulting
document itself. [Note: Conformance is defined in terms of the behavior of programs. —end note]
4.2 Namespaces and headers [general.namespaces]
1
Whenever a namex declared in subclause 21.11 at namespace scope is mentioned, the name x is assumed to
be fully qualified as ::std::experimental::reflect::v1::x, unless otherwise specified. The header de-
scribed in this document (see Table 1) shall import the contents of ::std::experimental::reflect::v1
into ::std::experimental::reflect as if by:
namespace std::experimental::reflect {
inline namespace v1 {}
}
2
Whenever a name x declared in the standard library at namespace scope is mentioned, the name x is
assumed to be fully qualified as ::std::x, unless otherwise specified.
Table 1 — Reflection library headers

4.3 Feature-testing recommendations [general.features]
1
An implementation that provides support for this document shall define each feature test macro defined
in Table 2 if no associated headers are indicated for that macro, and if associated headers are indicated
for a macro, that macro is defined after inclusion of one of the corresponding headers specified in the
table.
Table 2 — Feature-test macros
Macro name Value Header
__cpp_reflection 201902 none
__cpp_lib_reflection 201902
©ISO/IEC 2021 – All rights reserved 4

---------------------- Page: 9 ----------------------
ISO/IEC 23619:2021(E)
5 Lexical conventions [lex]
5.12 Keywords [lex.key]
1
In ISO/IEC 14882:2020 [lex.key], add the keyword reflexpr to the list of keywords in Table 4. Refer to
Annex A for compatibility with the original features of ISO/IEC 14882:2020.
©ISO/IEC 2021 – All rights reserved 5

---------------------- Page: 10 ----------------------
ISO/IEC 23619:2021(E)
6 Basic concepts [basic]
1
The set of changes proposed in this document, as applied to the specification of ISO/IEC 14882:2020,
shall be as per C++ Extensions for Concepts, ISO/IEC TS 19217:2015.
2
In ISO/IEC 14882:2020 [basic], add the following last paragraph:
An alias is a name introduced by atypedef declaration, an alias-declaration, or a using-declaration.
6.2 One definition rule [basic.def.odr]
1
In ISO/IEC 14882:2020 [basic.def.odr], insert a new paragraph after the existing paragraph 3:
A function or variable of static storage duration reflected by T (10.1.6.5) is odr-used by the
specialization std::experimental::reflect::get_pointer (21.11.4.9, 21.11.4.17), as if by
taking the address of an id-expression nominating the function or variable.
2
In ISO/IEC 14882:2020 [basic.def.odr], apply the following changes to the second bullet within paragraph
6:
and the object has the same value in all definitions of D, or a type implementing
std::experimental::reflect::Object (21.11.3.1), as long as all operations (21.11.4) on this
type yield the same constant expression results; and
6.9 Types [basic.types]
6.9.1 Fundamental types [basic.fundamental]
1
In ISO/IEC 14882:2020 [basic.fundamental], apply the following change to paragraph 9:
An expression of type void shall be used only as an expression statement (6.2), as an
operand of a comma expression (5.18), as a second or third operand of ?: (5.16), as the
operand of typeid, noexcept, reflexpr, or decltype, as the expression in a return statement
(6.6.3) for a function with the return type void, or as the operand of an explicit conversion
to type cv void.
©ISO/IEC 2021 – All rights reserved 6

---------------------- Page: 11 ----------------------
ISO/IEC 23619:2021(E)
7 Standard conversions [conv]
For Standard conversions, ISO/IEC 14882:2020, Clause 7 shall be used.
©ISO/IEC 2021 – All rights reserved 7

---------------------- Page: 12 ----------------------
ISO/IEC 23619:2021(E)
8 Expressions [expr]
8.1 Primary expressions [expr.prim]
8.1.2 Lambda expressions [expr.prim.lambda]
1
In ISO/IEC 14882:2020 [expr.prim.lambda], apply the following change to the second bullet in paragraph
12:
— names the entity in a potentially-evaluated expression (3.2) where the enclosing full-
expression depends on a generic lambda parameter declared within the reaching scope
of the lambda-expression.;
where, for the process of this determination, reflexpr operands are not considered to be
unevaluated operands.
2
Also apply the following change to paragraph 18:
Every id-expression within the compound-statement of a lambda-expression that is an odr-
use (6.2) of an entity captured by copy, as well as every use of an entity captured by copy
in a reflexpr-operand, is transformed into an access to the corresponding unnamed data
member of the closure type.
8.2 Postfix expressions [expr.post]
1
In ISO/IEC 14882:2020 [expr.post], apply the following change:
postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression [ braced-init-list ]
postfix-expression ( expression-list )
opt
function-call-expression
simple-type-specifier ( expression-list )
opt
typename-specifier ( expression-list )
opt
simple-type-specifier braced-init-list
typename-specifier braced-init-list
functional-type-conv-expression
postfix-expression . template id-expression
opt
postfix-expression -> template id-expression
opt
postfix-expression . pseudo-destructor-name
postfix-expression -> pseudo-destructor-name
postfix-expression ++
postfix-expression --
dynamic_cast < type-id > ( expression )
static_cast < type-id > ( expression )
reinterpret_cast < type-id > ( expression )
const_cast < type-id > ( expression )
typeid ( expression )
typeid ( type-id )
function-call-expression:
postfix-expression ( expression-list )
opt
functional-type-conv-expression:
simple-type-specifier ( expression-list )
opt
typename-specifier ( expression-list )
opt
simple-type-specifier braced-init-list
typename-specifier braced-init-list
expression-list:
initializer-list
©ISO/IEC 2021 – All rights reserved 8

---------------------- Page: 13 ----------------------
ISO/IEC 23619:2021(E)
9 Statements [stmt.stmt]
For Statements, ISO/IEC 14882:2020, Clause 9 shall be used.
©ISO/IEC 2021 – All rights reserved 9

---------------------- Page: 14 ----------------------
ISO/IEC 23619:2021(E)
10 Declarations [dcl.dcl]
10.1 Specifiers [dcl.spec]
10.1.6 Type specifiers [dcl.type]
10.1.6.2 Simple type specifiers [dcl.type.simple]
1
In ISO/IEC 14882:2020 [dcl.type.simple], apply the following change:
The simple type specifiers are
simple-type-specifier:
nested-name-specifier type-name
opt
nested-name-specifier template simple-template-id
char
char16_t
char32_t
wchar_t
bool
short
int
long
signed
unsigned
float
double
void
auto
decltype-specifier
reflexpr-specifier
type-name:
class-name
enum-name
typedef-name
simple-template-id
decltype-specifier:
decltype ( expression )
decltype ( auto )
reflexpr-specifier:
reflexpr ( reflexpr-operand )
reflexpr-operand:
::
type-id
nested-name-specifier namespace-name
opt
id-expression
( expression )
function-call-expression
functional-type-conv-expression
...
The other simple-type-specifiers specify either a previously-declared type, a type determined
from an expression, a reflection meta-object type (10.1.6.5), or one of the fundamental types
(6.9.1).
2
Append the following row to Table 10:
reflexpr ( reflexpr-operand ) the type as defined below
©ISO/IEC 2021 – All rights reserved 10

---------------------- Page: 15 ----------------------
ISO/IEC 23619:2021(E)
3
At the end of 7.1.6.2, insert the following paragraph:
For a reflexpr-operand x, the type denoted byreflexpr(x) is a type that satisfies the constraints
laid out in 10.1.6.5.
10.1.6.5 Reflection type specifiers [dcl.type.reflexpr]
Insert the following subclause:
1
The reflexpr-specifier yields a type T that allows inspection of some properties of its operand
through type traits or type transformations on T (21.11.4). The operand to the reflexpr-
specifier shall be a type, namespace, enumerator, variable, data member, function param-
eter, captured entity, parenthesized expression, function-call-expression or functional-type-
conv-expression. Any such T satisfies the requirements of reflect::Object (21.11.3) and
other reflect concepts, depending on the operand. A type satisfying the requirements of
reflect::Object is called a meta-object type. A meta-object type is an unnamed, incomplete
namespace-scope class type (Clause 9).
2
An entity or alias B is reflection-related to an entity or alias A if
(2.1)
— A and B are the same entity or alias,
(2.2)
— A is a variable or enumerator and B is the type of A,
(2.3)
— A is an enumeration and B is the underlying type of A,
(2.4)
— A is a class and B is a member or base class of A,
(2.5)
— A is a non-template alias that designates the entity B,
(2.6)
— A is not the global namespace and B is an enclosing class or namespace of A,
(2.7)
— A is the parenthesized expression ( B ),
(2.8)
— A is a lambda capture of the closure type B,
(2.9)
— A is the closure type of the lambda capture B,
(2.10)
— B is the type specified by the functional-type-conv-expression A,
(2.11)
— B is the function selected by overload resolution for a function-call-expression A,
(2.12)
— B is the return type, a parameter type, or function type of the function A, or
(2.13)
— B is reflection-related to an entity or alias X and X is reflection-related to A.
3
[ Note: This relationship is reflexive and transitive, but not symmetric. — end note ]
4
[ Example:
struct X;
struct B {
using X = ::X;
typedef X Y;
};
struct D : B {
using B::Y;
};
5
The alias D::Y is reflection-related to ::X, but not to B::Y or B::X. — end example ]
6
Zero or more successive applications of type transformations that yield meta-object types
(21.11.4) to the type denoted by a reflexpr-specifier enable inspection of entities and aliases
that are reflection-related to the operand; such a meta-object type is said to reflect the
respective reflection-related entity or alias.
7
[ Example:
template std::string get_type_name() {
namespace reflect = std::experimental::reflect;
// T_t is an Alias reflecting T:
using T_t = reflexpr(T);
// aliased_T_t is a Type reflecting the type for which T is a synonym:
using aliased_T_t = reflect::get_aliased_t;
return reflect::get_name_v;
}
std::cout << get_type_name(); // outputs basic_string
©ISO/IEC 2021 – All rights reserved 11

---------------------- Page: 16 ----------------------
ISO/IEC 23619:2021(E)
— end example ]
8
It is unspecified whether repeatedly applying reflexpr to the same operand yields the same
type or a different type. [ Note: If a meta-object type reflects an incomplete class type, certain
type transformations (21.11.4) cannot be applied. — end note ]
9
[ Example:
class X;
using X1_m = reflexpr(X);
class X {};
using X2_m = reflexpr(X);
using X_bases_1 = std::experimental::reflect::get_base_classes_t; // OK:
// X1_m reflects complete class X
using X_bases_2 = std::experimental::reflect::get_base_classes_t; // OK
std::experimental::reflect::get_reflected_type_t x; // OK: type X is complete
— end example ]
10
For the operand::, the type specified by the reflexpr-specifier satisfiesreflect::GlobalScope.
Otherwise, the type specified by the reflexpr-specifier satisfies concepts depending on the re-
sult of name lookup, as shown in Table 11. Any other reflexpr-operand renders the program
ill-formed.
11
If the reflexpr-operand of the form id-expression is a constant expression, the type specified
by the reflexpr-specifier also satisfies reflect::Constant.
12
If the reflexpr-operand designates a name whose declaration is enclosed in a block scope
(3.3.3) and the named entity is neither captured nor a function parameter, the program is
ill-formed. If the reflexpr-operand designates a class member, the type represented by the
reflexpr-specifier also satisfies reflect::RecordMember. If the reflexpr-operand designates an
expression, it is an unevaluated operand (Clause 5). If the reflexpr-operand designates both
an alias and a class name, the type represented by the reflexpr-specifier reflects the alias
and satisfies reflect::Alias.
©ISO/IEC 2021 – All rights reserved 12

---------------------- Page: 17 ----------------------
ISO/IEC 23619:2021(E)
Table 11 — reflect concept (21.11.3) that the type specified by a reflexpr-specifier satisfies, for a
given reflexpr-operand.
Category reflexpr-operand reflect Concept
Type class-name designating a union reflect::Record
class-name designating a closure type reflect::Lambda
class-name designating a non-union class reflect::Class
enum-name reflect::Enum
template type-parameter both reflect::Type
and reflect::Alias
decltype-specifier both reflect::Type
and reflect::Alias
type-name introduced by a using-declaration reflect::Type,
reflect::Alias, and
reflect::ScopeMember
any other typedef-name both reflect::Type
and reflect::Alias
any other type-id reflect::Type
Namespace namespace-alias both reflect::Namespace
and reflect::Alias
any other namespace-name reflect::Namespace
Expression the name of a data member reflect::Variable
the name of a variable reflect::Variable
the name of an enumerator reflect::Enumerator
the name of a function parameter reflect::FunctionParameter
the name of a captured entity reflect::LambdaCapture
a
parenthesized expression reflect::ParenthesizedExpression
b
function-call-expression reflect::FunctionCallExpression
c
functional-type-conv-expression reflect::FunctionalTypeConversion
a
For a reflexpr-operand that is a parenthesized expression (E), E shall be a function-call-expression,
0
functional-type-conv-expression, or an expression (E ) that satisfies the requirements for being a reflexpr-operand.
b
If the postfix-expression of the function-call-expression is of class type, the function call shall not resolve to a
surrogate call function (13.3.1.1.2). Otherwise, the postfix-expression shall name a function that is the unique result of
overload resolution.
c
The usual disambiguation between function-style cast and a type-id (8.2) applies. [Example: The default
constructor of class X can be reflected on as reflexpr((X())), while reflexpr(X()) reflects the type of a function
returning X. —end example]
©ISO/IEC 2021 – All rights reserved 13

---------------------- Page: 18 ----------------------
ISO/IEC 23619:2021(E)
11 Declarators [dcl.decl]
11.1 Type names [dcl.name]
1
In ISO/IEC 14882:2020 [dcl.name], apply the following changes:
To specify type conversions explicitly, and as an argument of sizeof, alignof, new, or typeid,
or reflexpr, the name of a type shall be specified.
©ISO/IEC 2021 – All rights reserved 14

---------------------- Page: 19 ----------------------
ISO/IEC 23619:2021(E)
12 Classes [class]
For Classes, ISO/IEC 14882:2020, Clause 12 shall be used.
©ISO/IEC 2021 – All rights reserved 15

---------------------- Page: 20 ----------------------
ISO/IEC 23619:2021(E)
13 Derived classes [class.derived]
For Derived classes, ISO/IEC 14882:2020, Clause 13 shall be used.
©ISO/IEC 2021 – All rights reserved 16

---------------------- Page: 21 ----------------------
ISO/IEC 23619:2021(E)
14 Member access control [class.access]
For Member access control, ISO/IEC 14882:2020, Clause 14 shall be used.
©ISO/IEC 2021 – All rights reserved 17

---------------------- Page: 22 ----------------------
ISO/IEC 23619:2021(E)
15 Special member functions [special]
For Special member functions, ISO/IEC 14882:2020, Clause 15 shall be used.
©ISO/IEC 2021 – All rights reserved 18

---------------------- Page: 23 ----------------------
ISO/IEC 23619:2021(E)
16 Overloading [over]
For Overloading, ISO/IEC 14882:2020, Clause 16 shall be used.
©ISO/IEC 2021 – All rights reserved 19

---------------------- Page: 24 ----------------------
ISO/IEC 23619:2021(E)
17 Templates [temp]
17.6 Name resolution [temp.res]
17.6.2 Dependent names [temp.dep]
17.6.2.1 Dependent types [temp.dep.type]
1
In ISO/IEC 14882:2020 [temp.dep.type], apply the following changes to paragraph 8:
A type is dependent if it is
[.]
(8.8)
— denoted by decltype(expression), where expression is type-dependent (14.6.2.2)., or
(8.9)
— denoted by reflexpr(operand), where operand is a type-dependent expression or a
(possibly parenthesized) functional-type-conv-expression with at least one type-dependent
immediate subexpression, or
(8.10)
— denoted byreflexpr(operand), where operand designates a dependent type or a member
of an unknown specialization or a value-dependent constant expression.
©ISO/IEC 2021 – All rights reserved 20

---------------------- Page: 25 ----------------------
ISO/IEC 23619:2021(E)
18 Exception handling [except]
For Exception handling, ISO/IEC 14882:2020, Clause 18 shall be used.
©ISO/IEC 2021 – All rights reserved 21

---------------------- Page: 26 ----------------------
ISO/IEC 23619:2021(E)
19 Preprocessing directives [cpp]
For Preprocessing directives, ISO/IEC 14882:2020, Clause 19 shall be used.
©ISO/IEC 2021 – All rights reserved 22

---------------------- Page: 27 ----------------------
ISO/IEC 23619:2021(E)
20 Library introduction [library]
20.6 Library-wide requirements [requirements]
20.6.1 Library contents and organization [organization]
20.6.1.2 Headers [headers]
1
Add to Table 14 – C++ library headers.
20.6.1.3 Freestanding implementations [compliance]
Modify Table 16 as follows.
++
Table 16 — C headers for freestanding implementations
Subclause Header(s)

18.2 Types
18.3 Implementation properties
18.4 Integer types
18.5 Start and termination
18.6 Dynamic memory management
18.7 Type identification
18.8 Exception handling
18.9 Initializer lists
18.10 Other runtime support
21.11 Static reflection
20.10 Type traits
20 Atomics
©ISO/IEC 2021 – All rights reserved 23

---------------------- Page: 28 ----------------------
ISO/IEC 23619:2021(E)
21 Language support library
[language.support]
1
Add a new subclause 21.11 titled "Static reflection" as follows:
21.11 Static reflection [reflect]
21.11.1 In general [reflect.general]
1
As laid out in 10.1.6.5, compile-time constant metadata, describing various aspects of a
program (static reflection data), can be accessed through meta-object types. The actual
metadata is obtained by instantiating templates constituting the interface of the meta-object
types. These templates are collectively referred to as meta-object operations.
2
Meta-object types satisfy different concepts (21.11.3) depending on the type they reflect
(10.1.6.5). These concepts can also be used for meta-object type classification. They form
a generalization-specialization hierarchy, with reflect::Object being the common general-
ization for all meta-object types. Unary operations and type transformations used to query
static reflection data associated with these concepts are described in 21.11.4.
21.11.2 Header synopsis [reflect.synopsis]
namespace std {
namespace experimental {
namespace reflect {
inline namespace v1 {
// 21.11.3 Concepts for meta-object types
template
concept bool Object = see below;
template
concept bool ObjectSequence = see below; // refines Object
template
concept bool TemplateParameterScope = see below; // refines Scope
template
concept bool Named = see below; // refines Object
template
concept bool Alias = see below; // refines Named and ScopeMember
template
concept bool RecordMember = see below; // refines ScopeMember
template
concept bool Enumerator = see below; // refines Constant
template
concept bool Variable = see below; // refines Typed and ScopeMember
template
concept bool ScopeMember = see below; // refines Named
template
concept bool Typed = see below; // refines Object
template
concept bool Namespace = see below; // refines Named and Scope
template
concept bool GlobalScope = see below; // refines Namespace
template
concept bool Class = see below; // refines Record
template
concept bool Enum = see below; // refines Type, Scope, and ScopeMember
template
©ISO/IEC 2021 – All rights reserved 24

---------------------- Page: 29 ----------------------
ISO/IEC 23619:2021(E)
concept bool Record = see below; // refines Type, Scope, and ScopeMember
template
concept bool Scope = see below; // refines Object
template
concept bool Type = see below; // refines Named
template
concept bool Constant = see below; // refines Typed and ScopeMember
template
concept bool Base = see below; // refines Object
template
concept bool FunctionParameter = see below; // refines Typed and ScopeMember
template
concept bool Callable = see below; // refines Scope and ScopeMember
template
concept bool Expression = see below; // refines Object
template
concept bool ParenthesizedExpression = see below; // refines Expression
template
concept bool FunctionCallExpression = see below; // refines Expression
template
concept bool FunctionalTypeConversion = see below; // refines Expression
template
concept bool Function = see below; // refines Typed and Callable
template
concept bool MemberFunction = see below; // refines RecordMember and Function
template
concept bool SpecialMemberFunction = see below; // refines RecordMember
template
concept bool Constructor = see below; // refines Callable and RecordMember
template
concept bool Destructor = see below; // refines Callable and SpecialMemberFunction
template
concept bool Operator = see below; // refines Function
template
concept bool ConversionOperator = see below; // refines MemberFunction and Operator
template
concept bool Lambda = see below; // refines Type and Scope
template
concept bool LambdaCapture = see below; // refines Variable
// 21.11.4 Meta-object operations
// Multi-concept operations
template struct is_public;
template struct is_protected;
template struct is_private;
template struct is_constexpr;
template struct is_static;
template struct is_final;
template struct is_explicit;
template struct is
...

TECHNICAL ISO/IEC TS
SPECIFICATION 23619
First edition
Information technology — C++
Extensions for reflection
PROOF/ÉPREUVE
Reference number
ISO/IEC TS 23619:2021(E)
©
ISO/IEC 2021

---------------------- Page: 1 ----------------------
ISO/IEC TS 23619:2021(E)

COPYRIGHT PROTECTED DOCUMENT
© ISO/IEC 2021
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting
on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address
below or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii PROOF/ÉPREUVE © ISO/IEC 2021 – All rights reserved

---------------------- Page: 2 ----------------------
ISO/IEC 23619:2021(E)
Contents
Foreword v
1 Scope 1
2 Normative references 2
3 Terms and definitions 3
4 General 4
4.1 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.2 Namespaces and headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.3 Feature-testing recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 Lexical conventions 5
5.12 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6 Basic concepts 6
6.2 One definition rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
6.9 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7 Standard conversions 7
8 Expressions 8
8.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
8.2 Postfix expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
9 Statements 9
10 Declarations 10
10.1 Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
11 Declarators 14
11.1 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
12 Classes 15
13 Derived classes 16
14 Member access control 17
15 Special member functions 18
16 Overloading 19
17 Templates 20
17.6 Name resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
18 Exception handling 21
19 Preprocessing directives 22
©ISO/IEC 2021 – All rights reserved iii

---------------------- Page: 3 ----------------------
ISO/IEC 23619:2021(E)
20 Library introduction 23
20.6 Library-wide requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
21 Language support library 24
21.11 Static reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
A Compatibility 45
++
A.1 C extensions for Concepts with Reflection and ISO/IEC 14882:2020 . . . . . . . . . . 45
Index 46
©ISO/IEC 2021 – All rights reserved iv

---------------------- Page: 4 ----------------------
ISO/IEC 23619:2021(E)
Foreword [foreword]
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission)formthespecializedsystemforworldwidestandardization. Nationalbodiesthataremembers
of ISO or IEC participate in the development of International Standards through technical committees
established by the respective organization to deal with particular fields of technical activity. ISO and
IEC technical committees collaborate in fields of mutual interest. Other international organizations,
governmental and non-governmental, in liaison with ISO and IEC, also take part in the work.
The procedures used to develop this document and those intended for its further maintenance are described
in the ISO/IEC Directives, Part 1. In particular, the different approval criteria needed for the different
types of document should be noted. This document was drafted in accordance with the editorial rules of
the ISO/IEC Directives, Part 2 (see www.iso.org/directives or www.iec.ch/members_experts/refdocs).
Attention is drawn to the possibility that some of the elements of this document may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
Details of any patent rights identified during the development of the document will be in the Introduction
and/or on the ISO list of patent declarations received (see www.iso.org/patents) or the IEC list of patent
declarations received (see patents.iec.ch).
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation of the voluntary nature of standards, the meaning of ISO specific terms and expressions
related to conformity assessment, as well as information about ISO’s adherence to the World Trade Orga-
nization (WTO) principles in the Technical Barriers to Trade (TBT) see www.iso.org/iso/foreword.html.
In the IEC, see www.iec.ch/understanding-standards.
This document was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 22, Programming languages, their environments and system software interfaces.
Any feedback or questions on this document should be directed to the user’s national standards body. A
complete listing of these bodies can be found at www.iso.org/members.html and www.iec.ch/national-
committees.
©ISO/IEC 2021 – All rights reserved v

---------------------- Page: 5 ----------------------
ISO/IEC 23619:2021(E)
1 Scope [scope]
1
++
This document describes extensions to the C Programming Language (Clause 2) that enable operations
on source code. These extensions include new syntactic forms and modifications to existing language
semantics, as well as changes and additions to the existing library facilities.
2
Instructions to modify or add paragraphs are written as explicit instructions. Modifications made directly
to existing text from ISO/IEC 14882:2020 use underlining to represent added text and strikethrough to
represent deleted text.
©ISO/IEC 2021 – All rights reserved 1

---------------------- Page: 6 ----------------------
ISO/IEC 23619:2021(E)
2 Normative references [refs]
1
The following documents are referred to in the text in such a way that some or all of their content
constitutes requirements of this document. For dated references, only the edition cited applies. For
undated references, the latest edition of the referenced document (including any amendments) applies.
(1.1)
— ISO/IEC 14882:2020, Programming Languages — C++
(1.2)
— ISO/IEC TS 19217:2015, C++ Extensions for Concepts
©ISO/IEC 2021 – All rights reserved 2

---------------------- Page: 7 ----------------------
ISO/IEC 23619:2021(E)
3 Terms and definitions [defs]
1
No terms and definitions are listed in this document. ISO and IEC maintain terminological databases for
use in standardization at the following addresses:
(1.1)
— IEC Electropedia: available at https://www.electropedia.org/
(1.2)
— ISO Online browsing platform: available at https://www.iso.org/obp
©ISO/IEC 2021 – All rights reserved 3

---------------------- Page: 8 ----------------------
ISO/IEC 23619:2021(E)
4 General [general]
4.1 Implementation compliance [general.compliance]
1
Conformance requirements for this document are those defined in ISO/IEC 14882:2020, 4.1. Similarly, all
references to ISO/IEC 14882:2020 in the resulting document shall be taken as referring to the resulting
document itself. [Note: Conformance is defined in terms of the behavior of programs. —end note]
4.2 Namespaces and headers [general.namespaces]
1
Whenever a namex declared in subclause 21.11 at namespace scope is mentioned, the name x is assumed to
be fully qualified as ::std::experimental::reflect::v1::x, unless otherwise specified. The header de-
scribed in this document (see Table 1) shall import the contents of ::std::experimental::reflect::v1
into ::std::experimental::reflect as if by:
namespace std::experimental::reflect {
inline namespace v1 {}
}
2
Whenever a name x declared in the standard library at namespace scope is mentioned, the name x is
assumed to be fully qualified as ::std::x, unless otherwise specified.
Table 1 — Reflection library headers

4.3 Feature-testing recommendations [general.features]
1
An implementation that provides support for this document shall define each feature test macro defined
in Table 2 if no associated headers are indicated for that macro, and if associated headers are indicated
for a macro, that macro is defined after inclusion of one of the corresponding headers specified in the
table.
Table 2 — Feature-test macros
Macro name Value Header
__cpp_reflection 201902 none
__cpp_lib_reflection 201902
©ISO/IEC 2021 – All rights reserved 4

---------------------- Page: 9 ----------------------
ISO/IEC 23619:2021(E)
5 Lexical conventions [lex]
5.12 Keywords [lex.key]
1
In ISO/IEC 14882:2020 [lex.key], add the keyword reflexpr to the list of keywords in Table 4. Refer to
Annex A for compatibility with the original features of ISO/IEC 14882:2020.
©ISO/IEC 2021 – All rights reserved 5

---------------------- Page: 10 ----------------------
ISO/IEC 23619:2021(E)
6 Basic concepts [basic]
1
The set of changes proposed in this document, as applied to the specification of ISO/IEC 14882:2020,
shall be as per C++ Extensions for Concepts, ISO/IEC TS 19217:2015.
2
In ISO/IEC 14882:2020 [basic], add the following last paragraph:
An alias is a name introduced by atypedef declaration, an alias-declaration, or a using-declaration.
6.2 One definition rule [basic.def.odr]
1
In ISO/IEC 14882:2020 [basic.def.odr], insert a new paragraph after the existing paragraph 3:
A function or variable of static storage duration reflected by T (10.1.6.5) is odr-used by the
specialization std::experimental::reflect::get_pointer (21.11.4.9, 21.11.4.17), as if by
taking the address of an id-expression nominating the function or variable.
2
In ISO/IEC 14882:2020 [basic.def.odr], apply the following changes to the second bullet within paragraph
6:
and the object has the same value in all definitions of D, or a type implementing
std::experimental::reflect::Object (21.11.3.1), as long as all operations (21.11.4) on this
type yield the same constant expression results; and
6.9 Types [basic.types]
6.9.1 Fundamental types [basic.fundamental]
1
In ISO/IEC 14882:2020 [basic.fundamental], apply the following change to paragraph 9:
An expression of type void shall be used only as an expression statement (6.2), as an
operand of a comma expression (5.18), as a second or third operand of ?: (5.16), as the
operand of typeid, noexcept, reflexpr, or decltype, as the expression in a return statement
(6.6.3) for a function with the return type void, or as the operand of an explicit conversion
to type cv void.
©ISO/IEC 2021 – All rights reserved 6

---------------------- Page: 11 ----------------------
ISO/IEC 23619:2021(E)
7 Standard conversions [conv]
For Standard conversions, ISO/IEC 14882:2020, Clause 7 shall be used.
©ISO/IEC 2021 – All rights reserved 7

---------------------- Page: 12 ----------------------
ISO/IEC 23619:2021(E)
8 Expressions [expr]
8.1 Primary expressions [expr.prim]
8.1.2 Lambda expressions [expr.prim.lambda]
1
In ISO/IEC 14882:2020 [expr.prim.lambda], apply the following change to the second bullet in paragraph
12:
— names the entity in a potentially-evaluated expression (3.2) where the enclosing full-
expression depends on a generic lambda parameter declared within the reaching scope
of the lambda-expression.;
where, for the process of this determination, reflexpr operands are not considered to be
unevaluated operands.
2
Also apply the following change to paragraph 18:
Every id-expression within the compound-statement of a lambda-expression that is an odr-
use (6.2) of an entity captured by copy, as well as every use of an entity captured by copy
in a reflexpr-operand, is transformed into an access to the corresponding unnamed data
member of the closure type.
8.2 Postfix expressions [expr.post]
1
In ISO/IEC 14882:2020 [expr.post], apply the following change:
postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression [ braced-init-list ]
postfix-expression ( expression-list )
opt
function-call-expression
simple-type-specifier ( expression-list )
opt
typename-specifier ( expression-list )
opt
simple-type-specifier braced-init-list
typename-specifier braced-init-list
functional-type-conv-expression
postfix-expression . template id-expression
opt
postfix-expression -> template id-expression
opt
postfix-expression . pseudo-destructor-name
postfix-expression -> pseudo-destructor-name
postfix-expression ++
postfix-expression --
dynamic_cast < type-id > ( expression )
static_cast < type-id > ( expression )
reinterpret_cast < type-id > ( expression )
const_cast < type-id > ( expression )
typeid ( expression )
typeid ( type-id )
function-call-expression:
postfix-expression ( expression-list )
opt
functional-type-conv-expression:
simple-type-specifier ( expression-list )
opt
typename-specifier ( expression-list )
opt
simple-type-specifier braced-init-list
typename-specifier braced-init-list
expression-list:
initializer-list
©ISO/IEC 2021 – All rights reserved 8

---------------------- Page: 13 ----------------------
ISO/IEC 23619:2021(E)
9 Statements [stmt.stmt]
For Statements, ISO/IEC 14882:2020, Clause 9 shall be used.
©ISO/IEC 2021 – All rights reserved 9

---------------------- Page: 14 ----------------------
ISO/IEC 23619:2021(E)
10 Declarations [dcl.dcl]
10.1 Specifiers [dcl.spec]
10.1.6 Type specifiers [dcl.type]
10.1.6.2 Simple type specifiers [dcl.type.simple]
1
In ISO/IEC 14882:2020 [dcl.type.simple], apply the following change:
The simple type specifiers are
simple-type-specifier:
nested-name-specifier type-name
opt
nested-name-specifier template simple-template-id
char
char16_t
char32_t
wchar_t
bool
short
int
long
signed
unsigned
float
double
void
auto
decltype-specifier
reflexpr-specifier
type-name:
class-name
enum-name
typedef-name
simple-template-id
decltype-specifier:
decltype ( expression )
decltype ( auto )
reflexpr-specifier:
reflexpr ( reflexpr-operand )
reflexpr-operand:
::
type-id
nested-name-specifier namespace-name
opt
id-expression
( expression )
function-call-expression
functional-type-conv-expression
...
The other simple-type-specifiers specify either a previously-declared type, a type determined
from an expression, a reflection meta-object type (10.1.6.5), or one of the fundamental types
(6.9.1).
2
Append the following row to Table 10:
reflexpr ( reflexpr-operand ) the type as defined below
©ISO/IEC 2021 – All rights reserved 10

---------------------- Page: 15 ----------------------
ISO/IEC 23619:2021(E)
3
At the end of 7.1.6.2, insert the following paragraph:
For a reflexpr-operand x, the type denoted byreflexpr(x) is a type that satisfies the constraints
laid out in 10.1.6.5.
10.1.6.5 Reflection type specifiers [dcl.type.reflexpr]
Insert the following subclause:
1
The reflexpr-specifier yields a type T that allows inspection of some properties of its operand
through type traits or type transformations on T (21.11.4). The operand to the reflexpr-
specifier shall be a type, namespace, enumerator, variable, data member, function param-
eter, captured entity, parenthesized expression, function-call-expression or functional-type-
conv-expression. Any such T satisfies the requirements of reflect::Object (21.11.3) and
other reflect concepts, depending on the operand. A type satisfying the requirements of
reflect::Object is called a meta-object type. A meta-object type is an unnamed, incomplete
namespace-scope class type (Clause 9).
2
An entity or alias B is reflection-related to an entity or alias A if
(2.1)
— A and B are the same entity or alias,
(2.2)
— A is a variable or enumerator and B is the type of A,
(2.3)
— A is an enumeration and B is the underlying type of A,
(2.4)
— A is a class and B is a member or base class of A,
(2.5)
— A is a non-template alias that designates the entity B,
(2.6)
— A is not the global namespace and B is an enclosing class or namespace of A,
(2.7)
— A is the parenthesized expression ( B ),
(2.8)
— A is a lambda capture of the closure type B,
(2.9)
— A is the closure type of the lambda capture B,
(2.10)
— B is the type specified by the functional-type-conv-expression A,
(2.11)
— B is the function selected by overload resolution for a function-call-expression A,
(2.12)
— B is the return type, a parameter type, or function type of the function A, or
(2.13)
— B is reflection-related to an entity or alias X and X is reflection-related to A.
3
[ Note: This relationship is reflexive and transitive, but not symmetric. — end note ]
4
[ Example:
struct X;
struct B {
using X = ::X;
typedef X Y;
};
struct D : B {
using B::Y;
};
5
The alias D::Y is reflection-related to ::X, but not to B::Y or B::X. — end example ]
6
Zero or more successive applications of type transformations that yield meta-object types
(21.11.4) to the type denoted by a reflexpr-specifier enable inspection of entities and aliases
that are reflection-related to the operand; such a meta-object type is said to reflect the
respective reflection-related entity or alias.
7
[ Example:
template std::string get_type_name() {
namespace reflect = std::experimental::reflect;
// T_t is an Alias reflecting T:
using T_t = reflexpr(T);
// aliased_T_t is a Type reflecting the type for which T is a synonym:
using aliased_T_t = reflect::get_aliased_t;
return reflect::get_name_v;
}
std::cout << get_type_name(); // outputs basic_string
©ISO/IEC 2021 – All rights reserved 11

---------------------- Page: 16 ----------------------
ISO/IEC 23619:2021(E)
— end example ]
8
It is unspecified whether repeatedly applying reflexpr to the same operand yields the same
type or a different type. [ Note: If a meta-object type reflects an incomplete class type, certain
type transformations (21.11.4) cannot be applied. — end note ]
9
[ Example:
class X;
using X1_m = reflexpr(X);
class X {};
using X2_m = reflexpr(X);
using X_bases_1 = std::experimental::reflect::get_base_classes_t; // OK:
// X1_m reflects complete class X
using X_bases_2 = std::experimental::reflect::get_base_classes_t; // OK
std::experimental::reflect::get_reflected_type_t x; // OK: type X is complete
— end example ]
10
For the operand::, the type specified by the reflexpr-specifier satisfiesreflect::GlobalScope.
Otherwise, the type specified by the reflexpr-specifier satisfies concepts depending on the re-
sult of name lookup, as shown in Table 11. Any other reflexpr-operand renders the program
ill-formed.
11
If the reflexpr-operand of the form id-expression is a constant expression, the type specified
by the reflexpr-specifier also satisfies reflect::Constant.
12
If the reflexpr-operand designates a name whose declaration is enclosed in a block scope
(3.3.3) and the named entity is neither captured nor a function parameter, the program is
ill-formed. If the reflexpr-operand designates a class member, the type represented by the
reflexpr-specifier also satisfies reflect::RecordMember. If the reflexpr-operand designates an
expression, it is an unevaluated operand (Clause 5). If the reflexpr-operand designates both
an alias and a class name, the type represented by the reflexpr-specifier reflects the alias
and satisfies reflect::Alias.
©ISO/IEC 2021 – All rights reserved 12

---------------------- Page: 17 ----------------------
ISO/IEC 23619:2021(E)
Table 11 — reflect concept (21.11.3) that the type specified by a reflexpr-specifier satisfies, for a
given reflexpr-operand.
Category reflexpr-operand reflect Concept
Type class-name designating a union reflect::Record
class-name designating a closure type reflect::Lambda
class-name designating a non-union class reflect::Class
enum-name reflect::Enum
template type-parameter both reflect::Type
and reflect::Alias
decltype-specifier both reflect::Type
and reflect::Alias
type-name introduced by a using-declaration reflect::Type,
reflect::Alias, and
reflect::ScopeMember
any other typedef-name both reflect::Type
and reflect::Alias
any other type-id reflect::Type
Namespace namespace-alias both reflect::Namespace
and reflect::Alias
any other namespace-name reflect::Namespace
Expression the name of a data member reflect::Variable
the name of a variable reflect::Variable
the name of an enumerator reflect::Enumerator
the name of a function parameter reflect::FunctionParameter
the name of a captured entity reflect::LambdaCapture
a
parenthesized expression reflect::ParenthesizedExpression
b
function-call-expression reflect::FunctionCallExpression
c
functional-type-conv-expression reflect::FunctionalTypeConversion
a
For a reflexpr-operand that is a parenthesized expression (E), E shall be a function-call-expression,
0
functional-type-conv-expression, or an expression (E ) that satisfies the requirements for being a reflexpr-operand.
b
If the postfix-expression of the function-call-expression is of class type, the function call shall not resolve to a
surrogate call function (13.3.1.1.2). Otherwise, the postfix-expression shall name a function that is the unique result of
overload resolution.
c
The usual disambiguation between function-style cast and a type-id (8.2) applies. [Example: The default
constructor of class X can be reflected on as reflexpr((X())), while reflexpr(X()) reflects the type of a function
returning X. —end example]
©ISO/IEC 2021 – All rights reserved 13

---------------------- Page: 18 ----------------------
ISO/IEC 23619:2021(E)
11 Declarators [dcl.decl]
11.1 Type names [dcl.name]
1
In ISO/IEC 14882:2020 [dcl.name], apply the following changes:
To specify type conversions explicitly, and as an argument of sizeof, alignof, new, or typeid,
or reflexpr, the name of a type shall be specified.
©ISO/IEC 2021 – All rights reserved 14

---------------------- Page: 19 ----------------------
ISO/IEC 23619:2021(E)
12 Classes [class]
For Classes, ISO/IEC 14882:2020, Clause 12 shall be used.
©ISO/IEC 2021 – All rights reserved 15

---------------------- Page: 20 ----------------------
ISO/IEC 23619:2021(E)
13 Derived classes [class.derived]
For Derived classes, ISO/IEC 14882:2020, Clause 13 shall be used.
©ISO/IEC 2021 – All rights reserved 16

---------------------- Page: 21 ----------------------
ISO/IEC 23619:2021(E)
14 Member access control [class.access]
For Member access control, ISO/IEC 14882:2020, Clause 14 shall be used.
©ISO/IEC 2021 – All rights reserved 17

---------------------- Page: 22 ----------------------
ISO/IEC 23619:2021(E)
15 Special member functions [special]
For Special member functions, ISO/IEC 14882:2020, Clause 15 shall be used.
©ISO/IEC 2021 – All rights reserved 18

---------------------- Page: 23 ----------------------
ISO/IEC 23619:2021(E)
16 Overloading [over]
For Overloading, ISO/IEC 14882:2020, Clause 16 shall be used.
©ISO/IEC 2021 – All rights reserved 19

---------------------- Page: 24 ----------------------
ISO/IEC 23619:2021(E)
17 Templates [temp]
17.6 Name resolution [temp.res]
17.6.2 Dependent names [temp.dep]
17.6.2.1 Dependent types [temp.dep.type]
1
In ISO/IEC 14882:2020 [temp.dep.type], apply the following changes to paragraph 8:
A type is dependent if it is
[.]
(8.8)
— denoted by decltype(expression), where expression is type-dependent (14.6.2.2)., or
(8.9)
— denoted by reflexpr(operand), where operand is a type-dependent expression or a
(possibly parenthesized) functional-type-conv-expression with at least one type-dependent
immediate subexpression, or
(8.10)
— denoted byreflexpr(operand), where operand designates a dependent type or a member
of an unknown specialization or a value-dependent constant expression.
©ISO/IEC 2021 – All rights reserved 20

---------------------- Page: 25 ----------------------
ISO/IEC 23619:2021(E)
18 Exception handling [except]
For Exception handling, ISO/IEC 14882:2020, Clause 18 shall be used.
©ISO/IEC 2021 – All rights reserved 21

---------------------- Page: 26 ----------------------
ISO/IEC 23619:2021(E)
19 Preprocessing directives [cpp]
For Preprocessing directives, ISO/IEC 14882:2020, Clause 19 shall be used.
©ISO/IEC 2021 – All rights reserved 22

---------------------- Page: 27 ----------------------
ISO/IEC 23619:2021(E)
20 Library introduction [library]
20.6 Library-wide requirements [requirements]
20.6.1 Library contents and organization [organization]
20.6.1.2 Headers [headers]
1
Add to Table 14 – C++ library headers.
20.6.1.3 Freestanding implementations [compliance]
Modify Table 16 as follows.
++
Table 16 — C headers for freestanding implementations
Subclause Header(s)

18.2 Types
18.3 Implementation properties
18.4 Integer types
18.5 Start and termination
18.6 Dynamic memory management
18.7 Type identification
18.8 Exception handling
18.9 Initializer lists
18.10 Other runtime support
21.11 Static reflection
20.10 Type traits
20 Atomics
©ISO/IEC 2021 – All rights reserved 23

---------------------- Page: 28 ----------------------
ISO/IEC 23619:2021(E)
21 Language support library
[language.support]
1
Add a new subclause 21.11 titled "Static reflection" as follows:
21.11 Static reflection [reflect]
21.11.1 In general [reflect.general]
1
As laid out in 10.1.6.5, compile-time constant metadata, describing various aspects of a
program (static reflection data), can be accessed through meta-object types. The actual
metadata is obtained by instantiating templates constituting the interface of the meta-object
types. These templates are collectively referred to as meta-object operations.
2
Meta-object types satisfy different concepts (21.11.3) depending on the type they reflect
(10.1.6.5). These concepts can also be used for meta-object type classification. They form
a generalization-specialization hierarchy, with reflect::Object being the common general-
ization for all meta-object types. Unary operations and type transformations used to query
static reflection data associated with these concepts are described in 21.11.4.
21.11.2 Header synopsis [reflect.synopsis]
namespace std {
namespace experimental {
namespace reflect {
inline namespace v1 {
// 21.11.3 Concepts for meta-object types
template
concept bool Object = see below;
template
concept bool ObjectSequence = see below; // refines Object
template
concept bool TemplateParameterScope = see below; // refines Scope
template
concept bool Named = see below; // refines Object
template
concept bool Alias = see below; // refines Named and ScopeMember
template
concept bool RecordMember = see below; // refines ScopeMember
template
concept bool Enumerator = see below; // refines Constant
template
concept bool Variable = see below; // refines Typed and ScopeMember
template
concept bool ScopeMember = see below; // refines Named
template
concept bool Typed = see below; // refines Object
template
concept bool Namespace = see below; // refines Named and Scope
template
concept bool GlobalScope = see below; // refines Namespace
template
concept bool Class = see below; // refines Record
template
concept bool Enum = see below; // refines Type, Scope, and ScopeMember
template
©ISO/IEC 2021 – All rights reserved 24

---------------------- Page: 29 ----------------------
ISO/IEC 23619:2021(E)
concept bool Record = see below; // refines Type, Scope, and ScopeMember
template
concept bool Scope = see below; // refines Object
template
concept bool Type = see below; // refines Named
template
concept bool Constant = see below; // refines Typed and ScopeMember
template
concept bool Base = see below; // refines Object
template
concept bool FunctionParameter = see below; // refines Typed and ScopeMember
template
concept bool Callable = see below; // refines Scope and ScopeMember
template
concept bool Expression = see below; // refines Object
template
concept bool ParenthesizedExpression = see below; // refines Expression
template
concept bool FunctionCallExpression = see below; // refines Expression
template
concept bool FunctionalTypeConversion = see below; // refines Expression
template
concept bool Function = see below; // refines Typed and Callable
template
concept bool MemberFunction = see below; // refines RecordMember and Function
template
concept bool SpecialMemberFunction = see below; // refines RecordMember
template
concept bool Constructor = see below; // refines Callable and RecordMember
template
concept bool Destructor = see below; // refines Callable and SpecialMemberFunction
template
concept bool Operator = see below; // refines Function
template
concept bool ConversionOperator = see below; // refines MemberFunction and Operator
template
concept bool Lambda = see below; // refines Type and Scope
template
concept bool LambdaCapture = see below; // refines Variable
// 21.11.4 Meta-object operations
// Multi-concept operations
template struct is_public;
template struct is_protected;
template struct is_private;
template struct is_constexpr;
template struct is_static;
template struct is_final;
template struct is_explicit;
template struct is_inline;
template struct is_virtual;
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.