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 1 week ago

Messages

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-05-29 00:00:00admincreate