2 // The LLVM Compiler Infrastructure
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
10 // CONFIG C++ rdar://6243400,rdar://6289367
22 TestObject(CONST TestObject& inObj);
26 TestObject& operator=(CONST TestObject& inObj);
28 int version() CONST { return _version; }
33 TestObject::TestObject(CONST TestObject& inObj)
37 _version = inObj._version;
38 //printf("%p (%d) -- TestObject(const TestObject&) called\n", this, _version);
42 TestObject::TestObject()
44 _version = ++constructors;
45 //printf("%p (%d) -- TestObject() called\n", this, _version);
49 TestObject::~TestObject()
51 //printf("%p -- ~TestObject() called\n", this);
56 TestObject& TestObject::operator=(CONST TestObject& inObj)
58 //printf("%p -- operator= called\n", this);
59 _version = inObj._version;
68 void (^b)(void) = ^{ printf("my const copy of one is %d\n", one.version()); };
73 int main(int argc, char *argv[]) {
75 if (constructors == 0) {
76 printf("No copy constructors!!!\n");
79 if (constructors != destructors) {
80 printf("%d constructors but only %d destructors\n", constructors, destructors);
83 printf("%s:success\n", argv[0]);