cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

GB-059 10.2 [module.interface] Meaningless template exports #431

Closed wg21bot closed 1 year ago

wg21bot commented 1 year ago

The wording for export appears to allow various meaningless constructs, such as template export void foo().

A possible resolution is presented in P2615R0, but did not achieve consensus.

jfbastien commented 1 year ago

Paper: https://github.com/cplusplus/papers/issues/1236

BengtGustafsson commented 1 year ago

The wording change and associated notes does not seem to specify what happens if a non-name declaration is present in the declaration-seq of this grammar alternative:

export { declaration-seqopt }

Maybe this is stated in some unchanged wording, but as name-declaration is a new term I doubt it. There are two solutions I can think of:

  1. The export around the declaration block only pertains to name-declarations, other declarations in the block are not exported but done locally.
  2. Other declarations than name-declarations are prohibited in the declaration-seq of an export block.

I'm not fluent enough in modules yet to know which is more reasonable but at least 1 seems to not break any existing code. And static_asserts at least could be valuable to write inside such a declaration-seq.

Anyway, it might warrant a comment that only the name-declarations are actually exported.

erichkeane commented 1 year ago

1: export static_assert(true); // mild preference for bad 2: export {static_assert(true);} // strong preference for OK 3: export template void f(); // strong preference for bad 4: template export void f(); // strong preference for bad 5: export {template void f();} // strong preference for OK

Forward P2615R0 (CWG 2443 resolution) to CWG for inclusion in C++23 (Options 2-5 as preferred above, Option 1 still prohibited). SF F N A SA
10 9 4 2 0

Result: Consensus

Additionally permit Option 1 above as proposed in D2715R0. SF F N A SA
2 6 13 1 0

Result: Consensus

jfbastien commented 1 year ago

Resolved by https://github.com/cplusplus/papers/issues/1236 and D2715R0

jensmaurer commented 1 year ago

See CWG2443

jensmaurer commented 1 year ago

Accepted with Modifications. See P2615R1 for details.