| 1 |
// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 2 |
|
| 3 |
template <typename T> |
| 4 |
struct Foo { |
| 5 |
private: |
| 6 |
T x; |
| 7 |
|
| 8 |
public: |
| 9 |
Foo(T x) : x(x) {} |
| 10 |
~Foo() {} |
| 11 |
|
| 12 |
T get() { return x; } |
| 13 |
void set(T _x) { x = _x; } |
| 14 |
}; |
| 15 |
|
| 16 |
template <typename T> |
| 17 |
struct Bar { |
| 18 |
private: |
| 19 |
struct Foo<T> foo; |
| 20 |
|
| 21 |
public: |
| 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 |
|
| 29 |
template <typename T> |
| 30 |
struct Baz : Foo<T> { |
| 31 |
public: |
| 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 |
|
| 38 |
template struct Foo<char>; |
| 39 |
|
| 40 |
template struct Foo<short>; |
| 41 |
|
| 42 |
// This should not generate lines for the implicit specialization of Foo, but |
| 43 |
// should generate lines for the explicit specialization of Bar. |
| 44 |
|
| 45 |
template struct Bar<int>; |
| 46 |
|
| 47 |
// This should not generate lines for the implicit specialization of Foo, but |
| 48 |
// should generate lines for the explicit specialization of Baz. |
| 49 |
|
| 50 |
template struct Baz<long>; |