xref: /llvm-project/clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp (revision 57833636816a13ccda53714413c532dc81e3b5ff)
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t -DINTERFACE
3 // RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DIMPLEMENTATION
4 // RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DEARLY_IMPLEMENTATION
5 // RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DUSER
6 
7 // expected-no-diagnostics
8 
9 #if defined(INTERFACE) || defined(EARLY_IMPLEMENTATION) || defined(IMPLEMENTATION)
10 module;
11 #endif
12 
13 #ifdef USER
14 import Foo;
15 #endif
16 
17 #ifdef EARLY_IMPLEMENTATION
18 module Foo;
19 #endif
20 
21 template<typename T> struct type_template {
22   typedef T type;
23   void f(type);
24 };
25 
f(type)26 template<typename T> void type_template<T>::f(type) {}
27 
28 template<int = 0, typename = int, template<typename> class = type_template>
29 struct default_template_args {};
30 
31 #ifdef INTERFACE
32 export module Foo;
33 #endif
34 
35 #ifdef IMPLEMENTATION
36 module Foo;
37 #endif
38