Repository navigation
Closed
Labels
Description
Describe the bug
A clear and concise description of what the bug is.
export module a;doesn't work in-pure-cpp2mode.#include "cpp2util.h"should be inserted in the GMF.
Additional work might also be necessary.- No declaration can be
exported. It's not part of the grammar, and as such can't happen in the generated code.
I suppose one can also run into an issue due to the lack of support forinline, similar to Fix duplicate symbol of cpp2::args() function #268.
To Reproduce
Steps to reproduce the behavior:
- Sample code - distilled down to minimal essentials please
- Command lines including which C++ compiler you are using
- Happens at the
cppfrontlevel. - TBD
- Happens at the
cppfrontlevel.
- Happens at the
- Expected result - what you expected to happen
- Cpp2 supports exporting modules.
- The functionality provided by the generated
#include "cpp2util.h"also works in module units. - Declarations can be
exported.
- Actual result/error
-
example.cpp2(1,1): error: pure-cpp2 switch disables Cpp1 syntax -
error: declaration of 'operator new' in module main follows declaration in the global module -
example.cpp2(2,13): error: missing semicolon at end of declaration (at 'namespace') example.cpp2(2,1): error: unexpected text at end of Cpp2 code section (at 'ns') example.cpp2(2,0): error: parse failed for section starting here
-
Additional context
Add any other context about the problem here.
Activity
gregmarr commentedon Mar 10, 2023
I haven't seen anything about CPP2 having
exportsupport yet.gregmarr commentedon Mar 10, 2023
I just meant that I don't see this as a bug but as not yet implemented.
hsutter commentedon Mar 11, 2023
[[meta]]
Timing note for @JohelEGP and @filipsajdak: As you can see I've started the preliminary work to implement UDTs, and I plan to do further major extension and cleanup in the remaining March weekends, plus probably a week of vacation to work on cppfront. So it might make sense to defer new/updated PRs until after March ends as things will quiet down again about three weeks from now, otherwise you'll probably find yourself with conflicts/rebasing.
@JohelEGP Thanks! There's basic modules support in mixed Cpp1/Cpp2 files, and one reason I've put further modules support lower down the design/implementation backlog list is because GCC and Clang don't support them yet (though I know support is in progress). Modules is the only major feature of C++20 (or C++23) that is available on only one of the three major implementations (see Clang status)... even
<format>(the other big feature that's been lagging) is further along and on the cusp of wide support being imminent in GCC 13 and being largely supported in Clang if you enable "experimental" ABI-unstable features. Given that modules don't really exist yet for portable code, I've pushed them down the backlog, though I hasten to add that Cpp2 is still a modules-first design... I can't wait for compilers to implement C++20!I think
exportwould go in the grammar on declaration... possibly as part of access-specifier because ifexportcan't be put on individual class members, then it could share the same grammar production as public/private/protected since it's mutually exclusive with them. I did the same thing withimplicitwhich shares a single this-specifier production with the virtual/override/final specifiers. (In today's Cpp1 grammar,explicit,virtual,override, andfinalare split up in five productions... function-specifier and base-specifier for the first one, explicit-specifier for the second, and virt-specifier and class-virt-specifier for the last two.)filipsajdak commentedon Mar 11, 2023
@hsutter I will continue and will do the rebate.
I will be mainly focusing on bugs and fixes making my project compilable.