mathstuf / cxx-modules-sandbox

Sandbox repository for various C++20 Modules use cases and how to build them
Apache License 2.0
62 stars 8 forks source link

More use cases #7

Open mathstuf opened 5 years ago

mathstuf commented 5 years ago

Some other use cases to add to this repository that I've mentioned elsewhere (Slack or Reddit):

const char* foo = "
#include <vector>
import M;
";
RedBeard0531 commented 5 years ago

I think to be conforming, that example would need to use a `R"(raw string)" since it spans multiple lines. I'd also make it use names that don't exist so it can't accidentally work.

Also missing is a test of importing a module from inside a non-translated #included header.

RedBeard0531 commented 5 years ago

Should have a test with attributes like import foo [[ns::a]] [[ns::b]];. Could be really evil and do import foo [[ns::evil("]]")]]; to break regexes that try to match attributes like import\s+((\w+)(\s*\.\s*\w+)*) *(\[\[[^\]]*\]\] *)*; .

RedBeard0531 commented 5 years ago
#define NO_SUCH_MODULE <some_header.h>
import NO_SUCH_MODULE;

Should be handled as a header unit import of <some_header.h> rather than importing a module named NO_SUCH_MODULE.

mathstuf commented 5 years ago

We also have the line continuation splits after @boris-kolpackov's paper. A few existing examples may now be ill-formed after that as well.