Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / utils / update_cc_test_checks / Inputs / explicit-template-instantiation.cpp
blob859e0c73ec119bb867f11f0240b1eca60799f92c
1 // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 template <typename T>
4 struct Foo {
5 private:
6 T x;
8 public:
9 Foo(T x) : x(x) {}
10 ~Foo() {}
12 T get() { return x; }
13 void set(T _x) { x = _x; }
16 template <typename T>
17 struct Bar {
18 private:
19 struct Foo<T> foo;
21 public:
22 Bar(T x) : foo(x) {}
23 ~Bar() {}
25 T get() { return foo.get(); }
26 void set(T _x) { foo.set(_x); }
29 template <typename T>
30 struct Baz : Foo<T> {
31 public:
32 Baz(T x) : Foo<T>(x) {}
33 ~Baz() {}
36 // These two specializations should generate lines for all of Foo's methods.
38 template struct Foo<char>;
40 template struct Foo<short>;
42 // This should not generate lines for the implicit specialization of Foo, but
43 // should generate lines for the explicit specialization of Bar.
45 template struct Bar<int>;
47 // This should not generate lines for the implicit specialization of Foo, but
48 // should generate lines for the explicit specialization of Baz.
50 template struct Baz<long>;