Skip to content

Incorrect/Invalid diagnostic: initializer was not imported from C header #83221

@rauhul

Description

@rauhul

Description

I see the following behavior with an imported api:

// swift:
Cannot convert value of type 'UnsafeMutableRawPointer' to expected argument type 'UnsafeMutablePointer<UInt8>' because initializer 'init(x:y:interlaced:buffer:count:)' was not imported from C header

// imported api:
public init(x: Int32, y: Int32, interlaced: Bool, buffer: UnsafeMutablePointer<UInt8>, count: Int32)
// c header:
/// Video frame output structure.
///
/// Contains the generated video frame data and metadata.
typedef struct {
    /// Horizontal resolution in pixels.
    int x;
    /// Vertical resolution in pixels.
    int y;
    /// Whether the frame is interlaced.
    bool interlaced;
    /// Pointer to the video frame buffer.
    ///
    /// This buffer is owned by the host.
    uint8_t* buffer;
    /// Number of bytes in the buffer.
    int count;
} video_frame_t SWIFT_NAME(VideoFrame);

Reproduction

See attached package.

Expected behavior

dont and allow implicit cast

Environment

Apple Swift version 6.2-dev (LLVM bba436f29ae40dd, Swift 6b29700)
Target: arm64-apple-macosx26.0
Build config: +assertions

Additional information

repro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with Cclang importerArea → compiler: The clang importer

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions