| 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/Templ.cppm -emit-module-interface -o %t/Templ.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/Use.cppm -fprebuilt-module-path=%t -emit-module-interface -o %t/Use.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cpp -verify -fsyntax-only |
| 8 |
|
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/Templ.cppm -emit-reduced-module-interface -o %t/Templ.pcm |
| 10 |
// RUN: %clang_cc1 -std=c++20 %t/Use.cppm -fprebuilt-module-path=%t -emit-reduced-module-interface -o %t/Use.pcm |
| 11 |
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -I%t %t/Use.cpp -verify -fsyntax-only |
| 12 |
// |
| 13 |
//--- Templ.h |
| 14 |
#ifndef TEMPL_H |
| 15 |
#define TEMPL_H |
| 16 |
template <class T> |
| 17 |
class Wrapper { |
| 18 |
public: |
| 19 |
T value; |
| 20 |
}; |
| 21 |
#endif |
| 22 |
|
| 23 |
//--- Templ.cppm |
| 24 |
export module Templ; |
| 25 |
export template <class T> |
| 26 |
class Wrapper2 { |
| 27 |
public: |
| 28 |
T value; |
| 29 |
}; |
| 30 |
|
| 31 |
//--- Use.cppm |
| 32 |
module; |
| 33 |
#include "Templ.h" |
| 34 |
export module Use; |
| 35 |
import Templ; |
| 36 |
|
| 37 |
export template <class T> |
| 38 |
class Use { |
| 39 |
public: |
| 40 |
Wrapper<T> value; |
| 41 |
Wrapper2<T> value2; |
| 42 |
}; |
| 43 |
|
| 44 |
export template <class T> |
| 45 |
Wrapper<T> wrapper; |
| 46 |
|
| 47 |
//--- Use.cpp |
| 48 |
// expected-no-diagnostics |
| 49 |
module; |
| 50 |
#include "Templ.h" |
| 51 |
export module User; |
| 52 |
|
| 53 |
export template <class T> |
| 54 |
class User { |
| 55 |
public: |
| 56 |
Wrapper<T> value; |
| 57 |
}; |