Skip to content

swift-foundation is incompatible with windows UCRT when C++ interoperability is enabled #75691

Closed
@hyp

Description

@hyp

Description

New swift-foundation that swift-corelibs-foundation is based on is broken on windows when C++ interoperability is enabled, as it imports and builds the entire ucrt module which has a restriction on the C.complex submodule:

<module-includes>:1:10: note: in file included from <module-includes>:1:

1 | #include "_FoundationCShims.h"

  |          `- note: in file included from <module-includes>:1:

2 | 



C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_FoundationCShims.h:17:10: note: in file included from C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_FoundationCShims.h:17:

15 | 

16 | #include "_CShimsTargetConditionals.h"

17 | #include "_CStdlib.h"

   |          `- note: in file included from C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_FoundationCShims.h:17:

18 | #include "CFUniCharBitmapData.inc.h"

19 | #include "CFUniCharBitmapData.h"



C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_CStdlib.h:23:2: note: in file included from C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_CStdlib.h:23:

 21 | 

 22 | #if __has_include(<ctype.h>)

 23 | #include <ctype.h>

    |  `- note: in file included from C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\include\_FoundationCShims/_CStdlib.h:23:

 24 | #endif

 25 | 



<unknown>:0: error: could not build C module '_FoundationCShims'

C:\Users\runner\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\ucrt.modulemap:15:12: error: module 'ucrt.C.complex' is incompatible with feature 'cplusplus'

 13 | module ucrt [system] {

 14 |   module C {

 15 |     module complex {

    |            `- error: module 'ucrt.C.complex' is incompatible with feature 'cplusplus'

 16 |       /* disallow the header in C++ mode as it forwards to `ccomplex`.  */

 17 |       requires !cplusplus

Reproduction

import Foundation and enable C++ interop, windows host.

Expected behavior

It should work.

Environment

swift main

Additional information

No response

Metadata

Metadata

Assignees

Labels

FoundationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions