[PATCH] D136953: [C++20] Diagnose invalid and reserved module names
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 12:47:29 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaModule.cpp:241-248
+ // C++2b [module.unit]p1: ... The identifiers module and import shall not
+ // appear as identifiers in a module-name or module-partition. All
+ // module-names either beginning with an identifier consisting of std
+ // followed by zero or more digits or containing a reserved identifier
+ // ([lex.name]) are reserved and shall not be specified in a
+ // module-declaration; no diagnostic is required.
+ bool IsFirstComponent = true;
----------------
cor3ntin wrote:
> Did you consider making this a function?
> I think you could just check `Path[0]` for reserved stdxxx syntax, and then all parts for reserved/import/module. Might simplify the code a bit.
I'm not opposed.
================
Comment at: clang/test/Modules/reserved-names-2.cpp:6
+// is not the first part of the path.
+export module should_fail.std0;
+
----------------
cor3ntin wrote:
> should_fail? Did you mean the opposite?
Indeed I do, good catch!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136953/new/
https://reviews.llvm.org/D136953
More information about the cfe-commits
mailing list