cxx-modules-sandbox icon indicating copy to clipboard operation
cxx-modules-sandbox copied to clipboard

More use cases

Open mathstuf opened this issue 6 years ago • 4 comments

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

  • [x] generated sources
  • [x] code that can confuse naïve scanners:
const char* foo = "
#include <vector>
import M;
";
  • [x] module names expanded from macros (import and export)
  • [x] module names expanded from macros on the command line (import and export)
  • [ ] overlapping file basenames (foo.mpp and foo.cpp)

mathstuf avatar Apr 05 '19 19:04 mathstuf

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 avatar Jul 22 '19 11:07 RedBeard0531

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 avatar Jul 22 '19 11:07 RedBeard0531

#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.

RedBeard0531 avatar Jul 22 '19 11:07 RedBeard0531

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.

mathstuf avatar Jul 22 '19 12:07 mathstuf