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
24 TestObject(CONST TestObject& inObj);
28 TestObject& operator=(CONST TestObject& inObj);
32 int version() CONST { return _version; }
37 TestObject::TestObject(CONST TestObject& inObj)
41 _version = inObj._version;
42 //printf("%p (%d) -- TestObject(const TestObject&) called", this, _version);
46 TestObject::TestObject()
48 _version = ++constructors;
49 //printf("%p (%d) -- TestObject() called\n", this, _version);
53 TestObject::~TestObject()
55 //printf("%p -- ~TestObject() called\n", this);
60 TestObject& TestObject::operator=(CONST TestObject& inObj)
62 //printf("%p -- operator= called", this);
63 _version = inObj._version;
68 void TestObject::test(void) {
69 void (^b)(void) = ^{ recovered = _version; };
70 void (^b2)(void) = Block_copy(b);
86 int main(int argc, char *argv[]) {
89 printf("%s: success\n", argv[0]);
92 printf("%s: *** didn't recover byref block variable\n", argv[0]);