llvm-project/clang/test/Modules/reserved-names-2.cpp
Aaron Ballman b8ceb9f4e4 [C++20] Diagnose invalid and reserved module names
[module.unit]p1 specifies that module and import are invalid components
of a module name, that module names cannot contain reserved
identifiers, and that std followed by zero or more digits is reserved.

The first issue (module and import pseudo-keywords) requires a
diagnostic, the second issue (use of reserved identifiers) does not
require a diagnostic. We diagnose both the same -- the code is ill-
formed unless the module declaration is in a system "header". This
allows STL implementations to use the reserved module names while
preventing users from stealing them out from under us.

Differential Revision: https://reviews.llvm.org/D136953
2022-11-03 08:29:59 -04:00

7 lines
260 B
C++

// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
// expected-no-diagnostics
// Demonstrate that we don't consider use of 'std' followed by digits to be a
// reserved identifier if it is not the first part of the path.
export module should_succeed.std0;