| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir -p %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
|
| 5 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/module.cpp |
| 6 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/module.cpp |
| 7 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/import.cpp |
| 8 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/import.cpp |
| 9 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/_Test.cpp |
| 10 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/_Test.cpp |
| 11 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/__test.cpp |
| 12 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/__test.cpp |
| 13 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/te__st.cpp |
| 14 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/te__st.cpp |
| 15 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std.cpp |
| 16 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/std.cpp |
| 17 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std.foo.cpp |
| 18 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/std.foo.cpp |
| 19 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std0.cpp |
| 20 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/std0.cpp |
| 21 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std1000000.cpp |
| 22 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/std1000000.cpp |
| 23 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/module.cppm |
| 24 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/module.cppm |
| 25 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/import.cppm |
| 26 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/import.cppm |
| 27 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/_Test.cppm |
| 28 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/_Test.cppm |
| 29 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/__test.cppm |
| 30 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/__test.cppm |
| 31 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/te__st.cppm |
| 32 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/te__st.cppm |
| 33 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std.cppm |
| 34 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/std.cppm |
| 35 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std.foo.cppm |
| 36 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/std.foo.cppm |
| 37 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std0.cppm |
| 38 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/std0.cppm |
| 39 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/std1000000.cppm |
| 40 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/std1000000.cppm |
| 41 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/should_diag._Test.cppm |
| 42 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -DNODIAGNOSTICS -Wno-reserved-module-identifier %t/should_diag._Test.cppm |
| 43 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/system-module.cppm |
| 44 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/system-module.cppm |
| 45 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/system._Test.import.cppm |
| 46 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/system._Test.import.cppm |
| 47 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,loud %t/user.cpp |
| 48 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected -Wno-reserved-module-identifier %t/user.cpp |
| 49 |
|
| 50 |
//--- module.cpp |
| 51 |
module module; // expected-error {{'module' is an invalid name for a module}} |
| 52 |
|
| 53 |
//--- import.cpp |
| 54 |
module import; // expected-error {{'import' is an invalid name for a module}} |
| 55 |
|
| 56 |
//--- _Test.cpp |
| 57 |
module _Test; // loud-warning {{'_Test' is a reserved name for a module}} \ |
| 58 |
// expected-error {{module '_Test' not found}} |
| 59 |
|
| 60 |
//--- __test.cpp |
| 61 |
module __test; // loud-warning {{'__test' is a reserved name for a module}} \ |
| 62 |
// expected-error {{module '__test' not found}} |
| 63 |
|
| 64 |
//--- te__st.cpp |
| 65 |
module te__st; // loud-warning {{'te__st' is a reserved name for a module}} \ |
| 66 |
// expected-error {{module 'te__st' not found}} |
| 67 |
|
| 68 |
//--- std.cpp |
| 69 |
module std; // loud-warning {{'std' is a reserved name for a module}} \ |
| 70 |
// expected-error {{module 'std' not found}} |
| 71 |
|
| 72 |
//--- std.foo.cpp |
| 73 |
module std.foo; // loud-warning {{'std' is a reserved name for a module}} \ |
| 74 |
// expected-error {{module 'std.foo' not found}} |
| 75 |
|
| 76 |
//--- std0.cpp |
| 77 |
module std0; // loud-warning {{'std0' is a reserved name for a module}} \ |
| 78 |
// expected-error {{module 'std0' not found}} |
| 79 |
|
| 80 |
//--- std1000000.cpp |
| 81 |
module std1000000; // loud-warning {{'std1000000' is a reserved name for a module}} \ |
| 82 |
// expected-error {{module 'std1000000' not found}} |
| 83 |
|
| 84 |
//--- module.cppm |
| 85 |
export module module; // expected-error {{'module' is an invalid name for a module}} |
| 86 |
|
| 87 |
//--- import.cppm |
| 88 |
export module import; // expected-error {{'import' is an invalid name for a module}} |
| 89 |
|
| 90 |
//--- _Test.cppm |
| 91 |
module; |
| 92 |
#ifdef NODIAGNOSTICS |
| 93 |
// expected-no-diagnostics |
| 94 |
#endif |
| 95 |
export module _Test; // loud-warning {{'_Test' is a reserved name for a module}} |
| 96 |
|
| 97 |
//--- __test.cppm |
| 98 |
module; |
| 99 |
#ifdef NODIAGNOSTICS |
| 100 |
// expected-no-diagnostics |
| 101 |
#endif |
| 102 |
export module __test; // loud-warning {{'__test' is a reserved name for a module}} |
| 103 |
export int a = 43; |
| 104 |
|
| 105 |
//--- te__st.cppm |
| 106 |
module; |
| 107 |
#ifdef NODIAGNOSTICS |
| 108 |
// expected-no-diagnostics |
| 109 |
#endif |
| 110 |
export module te__st; // loud-warning {{'te__st' is a reserved name for a module}} |
| 111 |
export int a = 43; |
| 112 |
|
| 113 |
//--- std.cppm |
| 114 |
module; |
| 115 |
#ifdef NODIAGNOSTICS |
| 116 |
// expected-no-diagnostics |
| 117 |
#endif |
| 118 |
export module std; // loud-warning {{'std' is a reserved name for a module}} |
| 119 |
|
| 120 |
export int a = 43; |
| 121 |
|
| 122 |
//--- std.foo.cppm |
| 123 |
module; |
| 124 |
#ifdef NODIAGNOSTICS |
| 125 |
// expected-no-diagnostics |
| 126 |
#endif |
| 127 |
export module std.foo;// loud-warning {{'std' is a reserved name for a module}} |
| 128 |
|
| 129 |
//--- std0.cppm |
| 130 |
module; |
| 131 |
#ifdef NODIAGNOSTICS |
| 132 |
// expected-no-diagnostics |
| 133 |
#endif |
| 134 |
export module std0; // loud-warning {{'std0' is a reserved name for a module}} |
| 135 |
|
| 136 |
//--- std1000000.cppm |
| 137 |
module; |
| 138 |
#ifdef NODIAGNOSTICS |
| 139 |
// expected-no-diagnostics |
| 140 |
#endif |
| 141 |
export module std1000000; // loud-warning {{'std1000000' is a reserved name for a module}} |
| 142 |
|
| 143 |
//--- should_diag._Test.cppm |
| 144 |
module; |
| 145 |
#ifdef NODIAGNOSTICS |
| 146 |
// expected-no-diagnostics |
| 147 |
#endif |
| 148 |
export module should_diag._Test; // loud-warning {{'_Test' is a reserved name for a module}} |
| 149 |
|
| 150 |
//--- system-module.cppm |
| 151 |
module; // expected-error {{missing 'module' declaration at end of global module fragment introduced here}} |
| 152 |
// Show that being in a system header doesn't save you from diagnostics about |
| 153 |
// use of an invalid module-name identifier. |
| 154 |
# 34 "reserved-names-1.cpp" 1 3 |
| 155 |
export module module; // expected-error {{'module' is an invalid name for a module}} |
| 156 |
|
| 157 |
//--- system._Test.import.cppm |
| 158 |
module; // expected-error {{missing 'module' declaration at end of global module fragment introduced here}} |
| 159 |
# 34 "reserved-names-1.cpp" 1 3 |
| 160 |
export module _Test.import; // expected-error {{'import' is an invalid name for a module}} |
| 161 |
|
| 162 |
//--- user.cpp |
| 163 |
// We can still use a reserved name on imoport. |
| 164 |
import std; // expected-error {{module 'std' not found}} |