| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/interface.cppm -o %t/interface.pcm |
| 5 |
// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t/interface.pcm %t/implementation.cppm -verify -DIMPLEMENTATION |
| 6 |
// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t/interface.pcm %t/early_impl.cppm -verify -DEARLY_IMPLEMENTATION |
| 7 |
// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t/interface.pcm %t/user.cppm -verify -DUSER |
| 8 |
|
| 9 |
//--- interface.cppm |
| 10 |
// expected-no-diagnostics |
| 11 |
module; |
| 12 |
|
| 13 |
template<typename T> struct type_template { |
| 14 |
typedef T type; |
| 15 |
void f(type); |
| 16 |
}; |
| 17 |
|
| 18 |
template<typename T> void type_template<T>::f(type) {} |
| 19 |
|
| 20 |
template<int = 0, typename = int, template<typename> class = type_template> |
| 21 |
struct default_template_args {}; |
| 22 |
|
| 23 |
export module Foo; |
| 24 |
|
| 25 |
//--- implementation.cppm |
| 26 |
// expected-no-diagnostics |
| 27 |
module; |
| 28 |
|
| 29 |
template<typename T> struct type_template { |
| 30 |
typedef T type; |
| 31 |
void f(type); |
| 32 |
}; |
| 33 |
|
| 34 |
template<typename T> void type_template<T>::f(type) {} |
| 35 |
|
| 36 |
template<int = 0, typename = int, template<typename> class = type_template> |
| 37 |
struct default_template_args {}; |
| 38 |
|
| 39 |
module Foo; |
| 40 |
|
| 41 |
//--- early_impl.cppm |
| 42 |
// expected-no-diagnostics |
| 43 |
module; |
| 44 |
module Foo; |
| 45 |
|
| 46 |
template<typename T> struct type_template { |
| 47 |
typedef T type; |
| 48 |
void f(type); |
| 49 |
}; |
| 50 |
|
| 51 |
template<typename T> void type_template<T>::f(type) {} |
| 52 |
|
| 53 |
template<int = 0, typename = int, template<typename> class = type_template> |
| 54 |
struct default_template_args {}; |
| 55 |
|
| 56 |
//--- user.cppm |
| 57 |
// expected-no-diagnostics |
| 58 |
import Foo; |
| 59 |
|
| 60 |
template<typename T> struct type_template { |
| 61 |
typedef T type; |
| 62 |
void f(type); |
| 63 |
}; |
| 64 |
|
| 65 |
template<typename T> void type_template<T>::f(type) {} |
| 66 |
|
| 67 |
template<int = 0, typename = int, template<typename> class = type_template> |
| 68 |
struct default_template_args {}; |