xref: /llvm-project/clang/test/CodeGenCXX/cxx20-module-tmpl-1.cppm (revision ae4dce8659f313ca2034782583d31993212fa8bd)
1// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
2
3export module FOO;
4
5class One;
6class Two;
7
8export template<typename T> struct TPL
9{
10void M (T *);
11template<typename U> void N (T *, U*);
12};
13
14template<typename T>
15void TPL<T>::M (T *) {}
16
17template<typename T> template<typename U> void TPL<T>::N (T *, U*) {}
18
19// CHECK-DAG: void @_ZNW3FOO3TPLIS_3OneE1MEPS1_(
20template void TPL<One>::M (One *);
21// CHECK-DAG: void @_ZNW3FOO3TPLIS_3OneE1NIS_3TwoEEvPS1_PT_(
22template void TPL<One>::N<Two> (One *, Two *);
23
24namespace NMS {
25class One;
26class Two;
27
28export template<typename T> struct TPL
29{
30void M (T *);
31template<typename U> void N (T *, U*);
32};
33
34template<typename T>
35void TPL<T>::M (T *) {}
36
37template<typename T> template<typename U> void TPL<T>::N (T *, U*) {}
38
39// CHECK-DAG: void @_ZN3NMSW3FOO3TPLINS_S0_3OneEE1MEPS2_(
40template void TPL<One>::M (One *);
41// CHECK-DAG: void @_ZN3NMSW3FOO3TPLINS_S0_3OneEE1NINS_S0_3TwoEEEvPS2_PT_
42template void TPL<One>::N<Two> (One *, Two *);
43}
44