Skip to content

CWG3185 Exporting a static_assert-declaration #2802

@jensmaurer

Description

@jensmaurer

Writing export ; or export static_assert(true); seems misguided and is devoid of any meaning possibly intended to be conveyed by the export. There is already a prohibition to export declarations of partial specializations.

CWG3185 wants to forbid such practices. Note that the braced form of export is left alone, i.e.

export { ; static_assert(true); }

continues to be well-formed.

There was a poll by EWG a few years ago in response to a C++23 NB comment that was called consensus for allowing export static_assert(true);, but that was actually with a majority of "neutral" voters. It's unclear why that was called consensus.

https://github.com/cplusplus/nbballot/issues/428#issuecomment-1310766777

It might also be desirable to have the set of restrictions for export and extern "C" (in both situations, without the braces only) to match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EWGEvolution

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions