brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 6e22d82 Raw
42 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-module-interface -o %t/foo.pcm6// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -fsyntax-only -verify7 8// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-reduced-module-interface -o %t/foo.pcm9// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -fsyntax-only -verify10 11//--- foo.cppm12export module foo;13export template <typename T = int>14T v;15 16export template <int T = 8>17int v2;18 19export template <typename T>20class my_array {};21 22export template <template <typename> typename C = my_array>23int v3;24 25//--- use.cpp26import foo;27template <typename T = int>28T v; // expected-error {{declaration of 'v' in the global module follows declaration in module foo}}29     // expected-note@foo.cppm:3 {{previous declaration is here}}30 31template <int T = 8>32int v2; // expected-error {{declaration of 'v2' in the global module follows declaration in module foo}}33        // expected-note@foo.cppm:6 {{previous declaration is here}}34 35template <typename T>36class my_array {}; // expected-error {{declaration of 'my_array' in the global module follows declaration in module foo}}37                   // expected-note@foo.cppm:9 {{previous declaration is here}}38 39template <template <typename> typename C = my_array>40int v3; // expected-error {{declaration of 'v3' in the global module follows declaration in module foo}}41        // expected-note@foo.cppm:12 {{previous declaration is here}}42