constructor-default-arg.cpp revision aed2b3e5f3a1f849ee864c2a12e8d6a1bf8150c5
1// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && 2// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && 3// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && 4// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && 5// RUN: true 6 7extern "C" int printf(...); 8 9 10struct C { 11 C() : iC(6) {} 12 int iC; 13}; 14 15int foo() { 16 return 6; 17}; 18 19class X { // ... 20public: 21 X(int) {} 22 X(const X&, int i = 1, int j = 2, int k = foo()) { 23 printf("X(const X&, %d, %d, %d)\n", i, j, k); 24 } 25}; 26 27int main() 28{ 29 X a(1); 30 X b(a, 2); 31 X c = b; 32 X d(a, 5, 6); 33} 34// CHECK-LP64: call __ZN1XC1ERK1Xiii 35// CHECK-LP64: call __ZN1XC1ERK1Xiii 36// CHECK-LP64: call __ZN1XC1ERK1Xiii 37 38// CHECK-LP32: call L__ZN1XC1ERK1Xiii 39// CHECK-LP32: call L__ZN1XC1ERK1Xiii 40// CHECK-LP32: call L__ZN1XC1ERK1Xiii 41