Skip to content

Commit 9b11bff

Browse files
committed
Undo added operator check
1 parent d3281ce commit 9b11bff

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4982,7 +4982,7 @@ ValueDecl *cloneBaseMemberDecl(ValueDecl *decl, DeclContext *newContext) {
49824982
// support these we need to tell Swift to type check the synthesized bodies.
49834983
// TODO: we also currently don't support static functions. That shouldn't be
49844984
// too hard.
4985-
if (fn->isStatic() || cast<clang::FunctionDecl>(fn->getClangDecl())->isOverloadedOperator() ||
4985+
if (fn->isStatic() ||
49864986
(fn->getClangDecl() &&
49874987
isa<clang::FunctionTemplateDecl>(fn->getClangDecl())))
49884988
return nullptr;

test/Interop/Cxx/operators/Inputs/member-inline.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct AddressOnlyIntWrapper {
4949
return value + x * y;
5050
}
5151

52+
AddressOnlyIntWrapper operator-(AddressOnlyIntWrapper rhs) const {
53+
return AddressOnlyIntWrapper(value + rhs.value);
54+
}
5255
AddressOnlyIntWrapper &operator++() {
5356
value++;
5457
return *this;

test/Interop/Cxx/operators/member-inline.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ OperatorsTestSuite.test("LoadableBoolWrapper.exclaim (inline)") {
5050
expectEqual(false, resultExclaim.value)
5151
}
5252

53+
OperatorsTestSuite.test("AddressOnlyIntWrapper.minus") {
54+
let lhs = AddressOnlyIntWrapper(42)
55+
let rhs = AddressOnlyIntWrapper(23)
56+
57+
let result = lhs - rhs
58+
expectEqual(19, result.value)
59+
}
60+
5361
OperatorsTestSuite.test("AddressOnlyIntWrapper.call (inline)") {
5462
var wrapper = AddressOnlyIntWrapper(42)
5563

@@ -257,14 +265,6 @@ OperatorsTestSuite.test("PtrToPtr.subscript (inline)") {
257265
expectEqual(23, arr[0]![0]![0])
258266
}
259267

260-
OperatorsTestSuite.test("AddressOnlyIntWrapper.minus") {
261-
let lhs = AddressOnlyIntWrapper(42)
262-
let rhs = AddressOnlyIntWrapper(23)
263-
264-
let result = lhs - rhs
265-
expectEqual(19, result.value)
266-
}
267-
268268
// TODO: this causes a crash (does it also crash on main?)
269269
//OperatorsTestSuite.test("TemplatedSubscriptArrayByVal.subscript (inline)") {
270270
// let ptr: UnsafeMutablePointer<Int32> =

0 commit comments

Comments
 (0)