Skip to content

Commit 07c4a8f

Browse files
authored
Merge pull request swiftlang#77071 from swiftlang/egorzhdan/explicit-operator-bool
[cxx-interop] Add test for `explicit operator bool`
2 parents e86773a + c2cfd75 commit 07c4a8f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

test/Interop/Cxx/stdlib/overlay/Inputs/convertible-to-bool.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ struct DualOverloadBoolBox {
1616
operator bool() const { return value; }
1717
operator bool() { return value; }
1818
};
19+
20+
struct ExplicitBoolBox {
21+
private:
22+
bool value;
23+
24+
public:
25+
explicit operator bool() const { return value; }
26+
};

test/Interop/Cxx/stdlib/overlay/convertible-to-bool-module-interface.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010

1111
// CHECK: struct DualOverloadBoolBox : CxxConvertibleToBool {
1212
// CHECK: }
13+
14+
// CHECK: struct ExplicitBoolBox : CxxConvertibleToBool {
15+
// CHECK: }

0 commit comments

Comments
 (0)