|
| 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 | +#ifdef NODIAGNOSTICS |
| 92 | +// expected-no-diagnostics |
| 93 | +#endif |
| 94 | +export module _Test; // loud-warning {{'_Test' is a reserved name for a module}} |
| 95 | + |
| 96 | +//--- __test.cppm |
| 97 | +#ifdef NODIAGNOSTICS |
| 98 | +// expected-no-diagnostics |
| 99 | +#endif |
| 100 | +export module __test; // loud-warning {{'__test' is a reserved name for a module}} |
| 101 | +export int a = 43; |
| 102 | + |
| 103 | +//--- te__st.cppm |
| 104 | +#ifdef NODIAGNOSTICS |
| 105 | +// expected-no-diagnostics |
| 106 | +#endif |
| 107 | +export module te__st; // loud-warning {{'te__st' is a reserved name for a module}} |
| 108 | +export int a = 43; |
| 109 | + |
| 110 | +//--- std.cppm |
| 111 | +#ifdef NODIAGNOSTICS |
| 112 | +// expected-no-diagnostics |
| 113 | +#endif |
| 114 | +export module std; // loud-warning {{'std' is a reserved name for a module}} |
| 115 | + |
| 116 | +export int a = 43; |
| 117 | + |
| 118 | +//--- std.foo.cppm |
| 119 | +#ifdef NODIAGNOSTICS |
| 120 | +// expected-no-diagnostics |
| 121 | +#endif |
| 122 | +export module std.foo;// loud-warning {{'std' is a reserved name for a module}} |
| 123 | + |
| 124 | +//--- std0.cppm |
| 125 | +#ifdef NODIAGNOSTICS |
| 126 | +// expected-no-diagnostics |
| 127 | +#endif |
| 128 | +export module std0; // loud-warning {{'std0' is a reserved name for a module}} |
| 129 | + |
| 130 | +//--- std1000000.cppm |
| 131 | +#ifdef NODIAGNOSTICS |
| 132 | +// expected-no-diagnostics |
| 133 | +#endif |
| 134 | +export module std1000000; // loud-warning {{'std1000000' is a reserved name for a module}} |
| 135 | + |
| 136 | +//--- should_diag._Test.cppm |
| 137 | +#ifdef NODIAGNOSTICS |
| 138 | +// expected-no-diagnostics |
| 139 | +#endif |
| 140 | +export module should_diag._Test; // loud-warning {{'_Test' is a reserved name for a module}} |
| 141 | + |
| 142 | +//--- system-module.cppm |
| 143 | +// Show that being in a system header doesn't save you from diagnostics about |
| 144 | +// use of an invalid module-name identifier. |
| 145 | +# 34 "reserved-names-1.cpp" 1 3 |
| 146 | +export module module; // expected-error {{'module' is an invalid name for a module}} |
| 147 | + |
| 148 | +//--- system._Test.import.cppm |
| 149 | +# 34 "reserved-names-1.cpp" 1 3 |
| 150 | +export module _Test.import; // expected-error {{'import' is an invalid name for a module}} |
| 151 | + |
| 152 | +//--- user.cpp |
| 153 | +// We can still use a reserved name on imoport. |
| 154 | +import std; // expected-error {{module 'std' not found}} |
0 commit comments