Skip to content

Swift test targets using C targets don't seem to respect C language standard. #7997

Open
@Lancelotbronner

Description

@Lancelotbronner

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

Using C23 features will compile just fine (with cLanguageStandard: .c2x until you try to use them from a test target, the build will now fail on C23 features (bool without stdbool.h, digit separators 123'456, etc.).

Expected behavior

I would expect the C target to be compiled with the C23 language standard.

Actual behavior

Builds fail because the C target is built with the wrong standard.

Steps to reproduce

  1. You can use the following reproduction package: repro-c2x.zip
  2. Try to build the test target, both swift test and Xcode will fail to build with could not build Objective-C module 'crepro' because of Unknown type name 'bool'.

Swift Package Manager version/commit hash

see below

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Darwin [redacted] 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugswift testChanges impacting `swift test` tool

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions