Skip to content

Conversation

hnrklssn
Copy link
Contributor

@hnrklssn hnrklssn commented Oct 6, 2025

span is not available in all versions of libstd++, so make it a conditional header. Also adds other missing c++20 headers.

Fixing this triggered an assert when importing a constant initialized wchar_t variable, so that is also fixed. The reason is that wchar_t is mapped to Unicode.Scalar, which cannot be directly initialized by integer literals in Swift, triggering an assert when looking up the protocol conformance for _ExpressibleByBuiltinIntegerLiteral.

rdar://162074714
rdar://161999183

`span` is not available in all versions of libstd++, so make it a
conditional header. Also adds other missing c++20 headers.

Fixing this triggered an assert when importing a constant initialized
`wchar_t` variable, so that is also fixed. The reason is that `wchar_t`
is mapped to `Unicode.Scalar`, which cannot be directly initialized by
integer literals in Swift, triggering an assert when looking up the
protocol conformance for `_ExpressibleByBuiltinIntegerLiteral`.

rdar://162074714
@hnrklssn
Copy link
Contributor Author

hnrklssn commented Oct 6, 2025

@swift-ci please smoke test

@hnrklssn hnrklssn requested a review from Azoy October 6, 2025 23:18
@hnrklssn hnrklssn merged commit 3bc17bd into swiftlang:main Oct 7, 2025
3 checks passed
Comment on lines +4678 to +4681
// Do not attempts to import CWideChar (wchar_t) values. CWideChar is
// a typealias for Unicode.Scalar, which does not
// implement _ExpressibleByBuiltinIntegerLiteral.
// FIXME: import using _ExpressibleByUnicodeScalarLiteral.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a source breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change only affects sources that would previously trigger an assert, so I would not say it's source breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants