C++ Logo

sg15

Advanced search

Re: [D3034] Module Declarations Shouldn’t be Macros

From: Daniela Engert <dani_at_[hidden]>
Date: Mon, 6 Nov 2023 13:32:30 +0100
Am 06.11.2023 um 13:16 schrieb Boris Kolpackov via SG15:
> Boris Kolpackov via SG15 <sg15_at_[hidden]> writes:
>
>> Michael Spencer <bigcheesegs_at_[hidden]> writes:
>>
>>> On Fri, Nov 3, 2023 at 12:43 AM Boris Kolpackov <boris_at_[hidden]>
>>>
>>>> #ifdef VERSION
>>>> export module version;
>>>> #else
>>>> export module final;
>>>> #endif
>>>>
>>> This is already banned by the grammar. You can't have an if-group that
>>> spans a pp-module.
>> Surprising, but it seems this indeed was banned by P1857. FWIW, neither
>> GCC 13 nor Clang 17 enforce this.
> Check this out:
>
> https://sourcegraph.com/search?q=context:global+%23if+defined%28__cpp_modules%29+-file:.*test.*+-file:.*clang.*+-file:.*gcc.*&patternType=standard&case=yes&sm=1&groupBy=repo
>
> In particular, cases like these:
>
> #if defined(__cpp_modules)
> export module expresscpp;
> ...
>
> It may be illegal but seeing that it's not diagnosed, people are starting
> to do it.

Right, therefore the bug at DevCom that I have opened some time ago.

'expresscpp' was most likely never subjected to compilation as a module
given that it is unchanged for 3 years now and is requiring a
modularized C++ standard library. 'ut' and 'sml2' are from the same
author. I made Kris aware of the issue.

Dani

Received on 2023-11-06 12:32:33