Skip to content

[cxx-interop] Add tests for .pointee property access on derived type #68140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/Interop/Cxx/operators/Inputs/member-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,8 @@ struct AmbiguousOperatorStar2 {
const int &&operator*() const && { return static_cast<const int &&>(value); }
};

struct DerivedFromConstIterator : public ConstIterator {};

struct DerivedFromConstIteratorPrivately : private ConstIterator {};

#endif
3 changes: 3 additions & 0 deletions test/Interop/Cxx/operators/member-inline-typechecker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ let voidReturnType = HasPreIncrementOperatorWithVoidReturnType()
let voidReturnTypeResult: HasPreIncrementOperatorWithVoidReturnType = voidReturnType.successor()

let immortalIncrement = myCounter.successor() // expected-error {{value of type 'ImmortalCounter' has no member 'successor'}}

let derivedConstIter = DerivedFromConstIteratorPrivately()
derivedConstIter.pointee // expected-error {{value of type 'DerivedFromConstIteratorPrivately' has no member 'pointee'}}
6 changes: 6 additions & 0 deletions test/Interop/Cxx/operators/member-inline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,10 @@ OperatorsTestSuite.test("AmbiguousOperatorStar2.pointee") {
expectEqual(678, res)
}

OperatorsTestSuite.test("DerivedFromConstIterator.pointee") {
let stars = DerivedFromConstIterator()
let res = stars.pointee
expectEqual(234, res)
}

runAllTests()