xref: /llvm-project/clang/test/CodeGenCXX/cxx20-module-std-subst-1.cppm (revision b8ceb9f4e4bdb69b5c3ea1ccf8505fa244ca0a1e)
1// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
2
3module;
4# 5 __FILE__ 1
5class Pooh;
6class Piglet;
7# 8 "" 2
8
9# 8 "" 1 3
10export module std; // might happen, you can't say it won't!
11# 9 "" 2 3
12
13namespace std {
14export template<typename T> class allocator {
15// just for testing, not real!
16void M (T *);
17template <typename U> U *N (T *);
18};
19
20template<typename T> void allocator<T>::M (T *) {}
21template<typename T> template<typename U> U *allocator<T>::N (T *) {
22return nullptr;
23}
24
25// CHECK-DAG: void @_ZNStW3std9allocatorIiE1MEPi(
26template void allocator<int>::M (int *);
27// CHECK-DAG: @_ZNStW3std9allocatorIiE1NIfEEPT_Pi(
28template float *allocator<int>::N<float> (int *);
29}
30
31// CHECK-DAG: @_ZNStW3std9allocatorI4PoohE1MEPS1_(
32template void std::allocator<Pooh>::M (Pooh *);
33// CHECK-DAG: @_ZNStW3std9allocatorI4PoohE1NI6PigletEEPT_PS1_(
34template Piglet *std::allocator<Pooh>::N<Piglet> (Pooh *);
35