On 11/03/2016 01:17 AM, 'Gabriel Dos Reis' via SG2 - Modules wrote:
> The compiler error is consistent with the spec. The notation "export {}" does not introduce any form of scope and shouldn't be tought of as empty namespace or empty blocks or any scope construct.
>
> It is purely a convenience to group non-empty collection of export declarations.
That seems inconsistent with what we do for linkage-specifications,
i.e. language linkage such as 'extern "C" { ... }'.
There's no new scope here, either, yet we do allow empty contents
as per the grammar in 7.5p2.
Please open an issue so that this can be discussed in a wider
audience.
Jens
> In the scenario below, the code is more readable if you put the export with the declaration being conditionally exported.
>
>
> -------- Original message --------
> From: Dwayne Robinson <
dwa...@microsoft.com>
> Date: 11/2/16 5:01 PM (GMT-08:00)
> To: Gabriel Dos Reis <
g...@microsoft.com>
> Subject: Empty export {}
>
> Any empty export clause should be a nop rather than a compile error, which would be consistent with {namespaces, local scope, void functions} which all allow empty braces. Depending on project configuration, you may end up with an empty clause.
>
>
>
> error C2059: syntax error: '}'
>
>
>
> e.g.:
>
> …
>
>
>
> export
>
> {
>
> #ifndef_DEBUG
>
> classDebugHelper ...
>
> #endif
>
>
>
> #ifPROJECT_CONFIG_USE_CAT
>
> classCat ...
>
> #endif
>
>
>
> #ifPROJECT_CONFIG_USE_DOG
>
> classDog ...
>
> #endif
>
> }
>
>
>
> …
>
>
>
> (yes, I’m merrily mixing the preprocessor with modules, but these are global defines for the whole project.)
>
> --
> You received this message because you are subscribed to the Google Groups "SG2 - Modules" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
modules+u...@isocpp.org <mailto:
modules+u...@isocpp.org>.
> To post to this group, send email to
mod...@isocpp.org <mailto:
mod...@isocpp.org>.
> Visit this group at
https://groups.google.com/a/isocpp.org/group/modules/.