Skip to content

Commit e03903c

Browse files
committed
[interop][SwiftToCxx] add a test to verify class reference can't be directly constructed from a void *
1 parent 0ca6106 commit e03903c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend %S/swift-class-in-cxx.swift -typecheck -module-name Class -clang-header-expose-public-decls -emit-clang-header-path %t/class.h
4+
5+
// RUN: not %target-interop-build-clangxx -c %s -I %t -o %t/swift-class-execution.o
6+
7+
#include "class.h"
8+
9+
void test(void * _Nonnull p) {
10+
// Prohibited to construct class reference directly from opaque pointer.
11+
Class::ClassWithIntField x(p);
12+
}

0 commit comments

Comments
 (0)