Skip to content
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
10 changes: 5 additions & 5 deletions lib/Sema/CSDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4134,11 +4134,11 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
scratch);
};

auto returnTypeStr = cast<FuncDecl>(found)
->getResultInterfaceType()
->getAnyNominal()
->getName()
.str();
auto returnTy =
cast<FuncDecl>(found)->getResultInterfaceType()->getAnyNominal();
if (!returnTy)
continue;
auto returnTypeStr = returnTy->getName().str();

auto methodClangLoc = cxxMethod->getLocation();
auto methodSwiftLoc =
Expand Down
10 changes: 10 additions & 0 deletions test/Interop/Cxx/class/invalid-unsafe-projection-errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ struct M {
StringLiteral stringLiteral() const { return StringLiteral{"M"}; }
};

struct HasNonIteratorBeginMethod {
void begin() const;
void end() const;
};

//--- test.swift

import Test
Expand All @@ -48,3 +53,8 @@ public func test(x: M) {
// CHECK-NOT: error: value of type 'M' has no member 'stringLiteral'
x.stringLiteral()
}

public func test(_ x: HasNonIteratorBeginMethod) {
x.begin()
x.end()
}