[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / redundant-template-default-arg2.cpp
blobae1f0c7e69cc06ece8ab6e0cb47d725bf1d18617
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
8 // RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-reduced-module-interface -o %t/foo.pcm
9 // RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -fsyntax-only -verify
11 //--- foo.cppm
12 export module foo;
13 export template <typename T = int>
14 T v;
16 export template <int T = 8>
17 int v2;
19 export template <typename T>
20 class my_array {};
22 export template <template <typename> typename C = my_array>
23 int v3;
25 //--- use.cpp
26 import foo;
27 template <typename T = int>
28 T 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}}
31 template <int T = 8>
32 int 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}}
35 template <typename T>
36 class my_array {}; // expected-error {{redefinition of 'my_array'}}
37 // expected-note@foo.cppm:9 {{previous definition is here}}
39 template <template <typename> typename C = my_array>
40 int 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}}