Title
Applying `std::meta::alignment_of` to a not-yet-defined variable
Status
new
Section
[meta.reflection.layout]
Submitter
S. B. Tam

Created on 2026-05-29.00:00:00 last changed 5 days ago

Messages

Date: 2026-08-15.00:00:00

[ 2026-08-27; Reflector poll. ]

Set priority to 3 after reflector poll.

Date: 2026-05-29.00:00:00

For a reflection value `r` that represents a variable, `std::meta::alignment_of(r)` is specified to return the alignment requirement of the variable. If the variable's definition has an `alignas` specifier, its non-defining declaration does not (as permitted by [dcl.align] p6), and only the latter is reachable in the evaluation context, is the `std::meta::alignment_of` call valid? If yes, what should it return?

Example:

#include <meta>

extern char ch;
constexpr auto x = std::meta::alignment_of(^^ch);

alignas(64) char ch;
constexpr auto x2 = x; // x2 is 1 or 64?
History
Date User Action Args
2026-09-10 14:03:08adminsetmessages: + msg16585
2026-05-29 00:00:00admincreate