2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 // CONFIG C++ rdar://6243400,rdar://6289367
21 TestObject(CONST TestObject& inObj);
25 TestObject& operator=(CONST TestObject& inObj);
27 int version() CONST { return _version; }
32 TestObject::TestObject(CONST TestObject& inObj)
36 _version = inObj._version;
37 //printf("%p (%d) -- TestObject(const TestObject&) called\n", this, _version);
41 TestObject::TestObject()
43 _version = ++constructors;
44 //printf("%p (%d) -- TestObject() called\n", this, _version);
48 TestObject::~TestObject()
50 //printf("%p -- ~TestObject() called\n", this);
55 TestObject& TestObject::operator=(CONST TestObject& inObj)
57 //printf("%p -- operator= called\n", this);
58 _version = inObj._version;
67 void (^b)(void) = ^{ printf("my const copy of one is %d\n", one.version()); };
72 int main(int argc, char *argv[]) {
74 if (constructors == 0) {
75 printf("No copy constructors!!!\n");
78 if (constructors != destructors) {
79 printf("%d constructors but only %d destructors\n", constructors, destructors);
82 printf("%s:success\n", argv[0]);