Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / Reachability-template-instantiation.cpp
blob2170c7b92a370aa3e8ccd3882387bd24dc818d8f
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 //--- Templ.h
10 #ifndef TEMPL_H
11 #define TEMPL_H
12 template <class T>
13 class Wrapper {
14 public:
15 T value;
17 #endif
19 //--- Templ.cppm
20 export module Templ;
21 export template <class T>
22 class Wrapper2 {
23 public:
24 T value;
27 //--- Use.cppm
28 module;
29 #include "Templ.h"
30 export module Use;
31 import Templ;
33 export template <class T>
34 class Use {
35 public:
36 Wrapper<T> value;
37 Wrapper2<T> value2;
40 export template <class T>
41 Wrapper<T> wrapper;
43 //--- Use.cpp
44 // expected-no-diagnostics
45 module;
46 #include "Templ.h"
47 export module User;
49 export template <class T>
50 class User {
51 public:
52 Wrapper<T> value;