xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/constructor-template.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // REQUIRES: x86-registered-target
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s
3f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s
4f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s
5f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // PR4826
8f4a2713aSLionel Sambuc struct A {
AA9f4a2713aSLionel Sambuc   A() {
10f4a2713aSLionel Sambuc   }
11f4a2713aSLionel Sambuc };
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc template<typename T>
14f4a2713aSLionel Sambuc struct B {
BB15f4a2713aSLionel Sambuc   B(T) {}
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc   A nodes;
18f4a2713aSLionel Sambuc };
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc // PR4853
22f4a2713aSLionel Sambuc template <typename T> class List {
23f4a2713aSLionel Sambuc public:
List()24f4a2713aSLionel Sambuc   List(){ }     // List<BinomialNode<int>*>::List() remains undefined.
~List()25f4a2713aSLionel Sambuc   ~List() {}
26f4a2713aSLionel Sambuc };
27f4a2713aSLionel Sambuc 
28f4a2713aSLionel Sambuc template <typename T> class Node {
29f4a2713aSLionel Sambuc  int i;
30f4a2713aSLionel Sambuc public:
Node()31f4a2713aSLionel Sambuc  Node(){ }      // Node<BinomialNode<int>*>::Node() remains undefined.
~Node()32f4a2713aSLionel Sambuc  ~Node() {}
33f4a2713aSLionel Sambuc };
34f4a2713aSLionel Sambuc 
35f4a2713aSLionel Sambuc 
36f4a2713aSLionel Sambuc template<typename T> class BinomialNode : Node<BinomialNode<T>*> {
37f4a2713aSLionel Sambuc public:
BinomialNode(T value)38f4a2713aSLionel Sambuc   BinomialNode(T value) {}
39f4a2713aSLionel Sambuc   List<BinomialNode<T>*> nodes;
40f4a2713aSLionel Sambuc };
41f4a2713aSLionel Sambuc 
main()42f4a2713aSLionel Sambuc int main() {
43f4a2713aSLionel Sambuc   B<int> *n = new B<int>(4);
44f4a2713aSLionel Sambuc   BinomialNode<int> *node = new BinomialNode<int>(1);
45f4a2713aSLionel Sambuc   delete node;
46f4a2713aSLionel Sambuc }
47f4a2713aSLionel Sambuc 
48f4a2713aSLionel Sambuc // CHECK-LP64: __ZN4NodeIP12BinomialNodeIiEEC2Ev:
49f4a2713aSLionel Sambuc // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEEC1Ev:
50f4a2713aSLionel Sambuc // CHECK-LP64: __ZN4ListIP12BinomialNodeIiEED1Ev:
51f4a2713aSLionel Sambuc 
52f4a2713aSLionel Sambuc // CHECK-LP32: __ZN4NodeIP12BinomialNodeIiEEC2Ev:
53f4a2713aSLionel Sambuc // CHECK-LP32: __ZN4ListIP12BinomialNodeIiEEC1Ev:
54f4a2713aSLionel Sambuc // CHECK-LP32: __ZN4ListIP12BinomialNodeIiEED1Ev:
55