Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / explicitly-specialized-template.cpp
blob89677254ea739ac7c662360592e476acd9204ab7
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/X.cppm -emit-module-interface -o %t/X.pcm
6 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify
7 //
8 //--- foo.h
9 #ifndef FOO_H
10 #define FOO_H
11 template <typename T>
12 struct base {};
14 template <typename T>
15 struct foo;
17 template <typename T>
18 struct foo {};
20 template <>
21 struct foo<int> : base<int> {
22 int getInt();
24 #endif // FOO_H
26 //--- X.cppm
27 module;
28 #include "foo.h"
29 export module X;
30 export template <class T>
31 class X {
32 foo<int> x;
34 public:
35 int print() {
36 return x.getInt();
40 //--- Use.cpp
41 import X;
42 foo<int> f; // expected-error {{'foo' must be declared before it is used}}
43 // expected-note@* {{declaration here is not visible}}
44 int bar() {
45 X<int> x;
46 return x.print();