Skip to content

stdlib should raise minimum compatibility level #82448

Open
@Naville

Description

@Naville

Description

This triggers on building compatibility layer for watchOS:

/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.5.sdk/usr/include/c++/v1/optional:830:94: note: 'value' has been explicitly marked unavailable here
  830 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
      |                                                                                              ^
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/stdlib/toolchain/Compatibility50/Overrides.cpp:17:
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/stdlib/toolchain/Compatibility50/Overrides.h:17:
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/include/swift/Runtime/Metadata.h:20:
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/include/swift/ABI/Metadata.h:30:
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/include/swift/ABI/GenericContext.h:25:
In file included from /SRCROOT/AppleLLVM/6.1.0/swift/include/swift/ABI/TrailingObjects.h:58:
/SRCROOT/AppleLLVM/6.1.0/swift/stdlib/include/llvm/Support/Alignment.h:338:20: error: 'value' is unavailable: introduced in watchOS 5.0 unknown
  338 |   return Lhs ? Lhs.value() / Divisor : MaybeAlign();
      |                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.5.sdk/usr/include/c++/v1/optional:830:94: note: 'value' has been explicitly marked unavailable here
  830 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
      |                                                                                              ^
4 errors generated.

This is due to previously LLVM ships its own llvm::optional implementation, but since (I believe) LLVM 16-ish llvm::optional is an alias for std::optional, which is not available in watchOS 2.0, set by

set(COMPATIBILITY_MINIMUM_DEPLOYMENT_VERSION_WATCHOS "2.0")

Reproduction

Expected behavior

N/A

Environment

Swift 6.1.0, but should also trigger on ToT

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions