Skip to content
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

[SR-14963] [C++-Interop] fatal llvm::Error when using operator+ on CGPoint with ObjC & C++ Interop enabled #57305

Open
Tracked by #57304
swift-ci opened this issue Jul 23, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software objective-c interop Feature: Interoperability with Objective-C

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Jul 23, 2021

Previous ID SR-14963
Radar rdar://problem/83361944
Original Reporter plotfi (JIRA User)
Type Sub-task
Additional Detail from JIRA
Votes 0
Component/s
Labels Sub-task, CxxInterop
Assignee None
Priority Medium

md5: 627f57800f88fbd2925717c088588376

Parent-Task:

Issue Description:

This one is fairly strange since I have not been able to reproduce it without importing UIKit. The following fails in swift::ModuleFile::loadAllConformances with a fatal llvm::Error.

import UIKit
let Point1 = CGPoint()
let Point2 = Point1 + Point1

But if I were to extract some minimal Objective-C++ and put it in my own Module (Call it MyMinUIKit):

// Module MyMinUIKit
typedef double CGFloat;
struct CGPoint { CGFloat x; CGFloat y; };
typedef struct __attribute__((objc_boxable)) CGPoint CGPoint; 

and import MyMinUIKit instead of UIKit, then the above Swift would result in a normal compile error that tells that there is no operator+ in CGPoint:

error: binary operator '+' cannot be applied to two 'CGPoint' operands
let Point2 = Point1 + Point1
             ~~~~~~ ^ ~~~~~~

The command line to run this was:

swift -frontend -S -emit-ir -disable-implicit-concurrency-module-import \
    -enable-cxx-interop -enable-objc-interop \
    -target arm64-apple-ios14.5 -target-sdk-version 14.5 \
    -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk \
    main.swift
@zoecarver
Copy link
Contributor

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@zoecarver zoecarver added c++ interop Feature: Interoperability with C++ and removed CxxInterop labels Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software compiler The Swift compiler in itself c++ to swift Feature → c++ interop: c++ to swift objective-c interop Feature: Interoperability with Objective-C labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software objective-c interop Feature: Interoperability with Objective-C
Projects
None yet
Development

No branches or pull requests

3 participants