-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In case it helps you and/or your readers:
constexpr
variables need to beinline
to be exported.
Yes, with the export using
approach (since we need them to be the same even if multiple modules do this trick), although there is a proposal to change that for the obvious, painful, practical reasons.
Some libraries define template specializations in other namespaces, like
std
. These can probably not be exported with this approach, and would require additional work.
"Export" isn't a word that applies to a template specialization: export
is principally about name lookup and otherwise about linkage, and template specializations aren't found by name lookup and don't have linkage separately from their templates (as established on the declaration of the primary template). A specialization can be reachable or not, but it can be reachable even if it's for a template that is never exported anywhere.
Apparently, the specialization is not considered to be decl-reachable from the module purview and thus discarded.
I think that's a defect in the standard: it doesn't seem useful to have a class be reachable but not the specializations declared for it, although it might be difficult to specify all cases involving partial specializations or so.
In any case, it seems that there is a trivial workaround: provide a dummy declaration (after export module …;
) that mentions std::is_error_code_enum
itself, so that [module.global.frag]/3.5.7 makes the specialization decl-reachable.