51 lines · cpp
1// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s2 3template <typename T>4struct Foo {5private:6 T x;7 8public:9 Foo(T x) : x(x) {}10 ~Foo() {}11 12 T get() { return x; }13 void set(T _x) { x = _x; }14};15 16template <typename T>17struct Bar {18private:19 struct Foo<T> foo;20 21public:22 Bar(T x) : foo(x) {}23 ~Bar() {}24 25 T get() { return foo.get(); }26 void set(T _x) { foo.set(_x); }27};28 29template <typename T>30struct Baz : Foo<T> {31public:32 Baz(T x) : Foo<T>(x) {}33 ~Baz() {}34};35 36// These two specializations should generate lines for all of Foo's methods.37 38template struct Foo<char>;39 40template struct Foo<short>;41 42// This should not generate lines for the implicit specialization of Foo, but43// should generate lines for the explicit specialization of Bar.44 45template struct Bar<int>;46 47// This should not generate lines for the implicit specialization of Foo, but48// should generate lines for the explicit specialization of Baz.49 50template struct Baz<long>;51