[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / redundant-template-default-arg.cpp
blob20a806c4c818ab837bbd7d559feaca1e1da954ac
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 -I%t -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 -I%t -fsyntax-only -verify
11 //--- foo.h
12 template <typename T>
13 T u;
15 template <typename T = int>
16 T v;
18 template <int T = 8>
19 int v2;
21 template <typename T>
22 class my_array {};
24 template <template <typename> typename C = my_array>
25 int v3;
27 template <typename T, int *i = nullptr>
28 T v4;
30 template <typename T, T *i = nullptr>
31 T v5;
33 inline int a = 43;
34 template <typename T, int *i = &a>
35 T v6;
37 inline int b = 43;
38 template <typename T, T *i = &b>
39 T v7;
41 template <int T = (3 > 2)>
42 int v8;
44 consteval int getInt() {
45 return 55;
47 template <int T = getInt()>
48 int v9;
50 //--- foo.cppm
51 module;
52 #include "foo.h"
53 export module foo;
56 //--- use.cpp
57 // expected-no-diagnostics
58 import foo;
59 #include "foo.h"