Skip to content

CWG3185 Exporting a static_assert-declaration #2802

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.

Activity

  1. opensdh commented on Jun 1, 2026

    @opensdh

    We should rediscuss deduction guides if we're going to rediscuss things.

  2. hanickadot commented on Jun 8, 2026

    @hanickadot
    Collaborator

    EWG approves of the CWG proposed resolution to CWG3185, and forwards back to CWG. EWG also encourages CWG to consider the asm-declaration. Also, consider attribute-declaration.

    SF F N A SA
    1 15 5 2 0

    Result: consensus

  3. added and removed
    EWGEvolution
    on Jun 8, 2026
  4. moved this to Ready for review in CWGon Jun 8, 2026
  5. jensmaurer commented on Jun 12, 2026

    @jensmaurer
    MemberAuthor

    See P2615 Meaningful exports CWG2443 #1236

    R0 implements the direction that Davis wants, which probably needs EWG approval.

  6. moved this from Ready for review to Awaiting updated wording in CWGon Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Awaiting updated wording

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions