1 // RUN: rm -rf %t 2 // RUN: mkdir %t 3 // RUN: split-file %s %t 4 // 5 // RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-module-interface -o %t/foo.pcm 6 // RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -fsyntax-only -verify 7 8 //--- foo.cppm 9 export module foo; 10 export template <typename T = int> 11 T v; 12 13 export template <int T = 8> 14 int v2; 15 16 export template <typename T> 17 class my_array {}; 18 19 export template <template <typename> typename C = my_array> 20 int v3; 21 22 //--- use.cpp 23 import foo; 24 template <typename T = int> 25 T v; // expected-error {{declaration of 'v' in the global module follows declaration in module foo}} 26 // [email protected]:3 {{previous declaration is here}} 27 28 template <int T = 8> 29 int v2; // expected-error {{declaration of 'v2' in the global module follows declaration in module foo}} 30 // [email protected]:6 {{previous declaration is here}} 31 32 template <typename T> 33 class my_array {}; // expected-error {{redefinition of 'my_array'}} 34 // [email protected]:9 {{previous definition is here}} 35 36 template <template <typename> typename C = my_array> 37 int v3; // expected-error {{declaration of 'v3' in the global module follows declaration in module foo}} 38 // [email protected]:12 {{previous declaration is here}} 39