xref: /llvm-project/clang/test/Modules/Reachability-template-default-arg.cpp (revision c5e4afe6733c58e24023ede04275bbed3bde8240)
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 %t/template_default_arg.cppm -emit-module-interface -o %t/template_default_arg.pcm
6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify
7 
8 // RUN: %clang_cc1 -std=c++20 %t/template_default_arg.cppm -emit-reduced-module-interface -o %t/template_default_arg.pcm
9 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify
10 //
11 //--- template_default_arg.cppm
12 export module template_default_arg;
13 struct t {};
14 
15 export template <typename T = t>
16 struct A {
17   T a;
18 };
19 
20 //--- Use.cpp
21 import template_default_arg;
22 void bar() {
23   A<> a0;
24   A<t> a1; // expected-error {{use of undeclared identifier 't'}}
25 }
26