Skip to content

[SR-15409] Assertion failure: "expected a hidden declaration" when building with certain C header includes on Windows. #57723

@swift-ci

Description

@swift-ci
Previous ID SR-15409
Radar None
Original Reporter luiz (JIRA User)
Type Bug
Environment

Windows 10 Pro 19043.1288

compnerd.org Swift version 5.5 (swift-5.5-RELEASE)
Target: x86_64-unknown-windows-msvc

Windows 10 SDK 10.0.20348.0

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: ee35116b99f75e6c06c9bac968feeb18

Issue Description:

When attempting to build the following repository's state in Swift using 'swift build', the compiler fails with an assertion error: https://github.com/LuizZak/SwiftDx/tree/8eeb4d35ab0b9ff6e1e13ca2e2ad198f1f8d9784

Assertion:

Assertion failed: !D->isUnconditionallyVisible() && "expected a hidden declaration"

Full error message:

<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "D:\dev\SwiftDx\Sources\CDirect2D\include\CDirect2D.h"
         ^
D:\dev\SwiftDx\Sources\CDirect2D\include\CDirect2D.h:1:10: note: in file included from D:\dev\SwiftDx\Sources\CDirect2D\include\CDirect2D.h:1:
#include "../cd2d.h"
         ^
D:\dev\SwiftDx\Sources\CDirect2D\cd2d.h:13:10: note: in file included from D:\dev\SwiftDx\Sources\CDirect2D\cd2d.h:13:
#include <d2d1_3.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_3.h:16:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_3.h:16:
#include <d2d1_2.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_2.h:16:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_2.h:16:
#include <d2d1_1.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_1.h:16:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1_1.h:16:
#include <d2d1.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1.h:21:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\d2d1.h:21:
#include <D2DBaseTypes.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\D2DBaseTypes.h:19:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\D2DBaseTypes.h:19:
#include <dxgitype.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\dxgitype.h:88:17: error: missing '#include <dxgiformat.h>'; 'DXGI_FORMAT' must be defined before it is used
    DXGI_FORMAT Format;
                ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\dxgiformat.h:10:14: note: definition here is not reachable
typedef enum DXGI_FORMAT
             ^
Assertion failed: !D->isUnconditionallyVisible() && "expected a hidden declaration", file D:\a\1\s\llvm-project\clang\lib\Serialization\ASTWriter.cpp, line 6008
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.      C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\dxgitype.h:91:3: current parser token 'DXGI_MODE_DESC'
 #&#8203;0 0x00007ff69dd8e315 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x497e315)
 #&#8203;1 0x00007ff88ec81881 (C:\WINDOWS\System32\ucrtbase.dll+0x71881)
 #&#8203;2 0x00007ff88ec82851 (C:\WINDOWS\System32\ucrtbase.dll+0x72851)
 #&#8203;3 0x00007ff88ec841b5 (C:\WINDOWS\System32\ucrtbase.dll+0x741b5)
 #&#8203;4 0x00007ff88ec844f1 (C:\WINDOWS\System32\ucrtbase.dll+0x744f1)
 #&#8203;5 0x00007ff69c96065f (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x355065f)
 #&#8203;6 0x00007ff69c6b37d2 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x32a37d2)
 #&#8203;7 0x00007ff69d26726f (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3e5726f)
 #&#8203;8 0x00007ff69caace97 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x369ce97)
 #&#8203;9 0x00007ff69cb17af7 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3707af7)
#&#8203;10 0x00007ff69c8b045c (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x34a045c)
#&#8203;11 0x00007ff69c843858 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3433858)
#&#8203;12 0x00007ff69c85120a (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x344120a)
#&#8203;13 0x00007ff69c83fb69 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x342fb69)
#&#8203;14 0x00007ff69c81de22 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x340de22)
#&#8203;15 0x00007ff69c82264d (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x341264d)
#&#8203;16 0x00007ff69c826c93 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3416c93)
#&#8203;17 0x00007ff69c699e06 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3289e06)
#&#8203;18 0x00007ff69c699c18 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3289c18)
#&#8203;19 0x00007ff69c683d78 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3273d78)
#&#8203;20 0x00007ff69c680ffa (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3270ffa)
#&#8203;21 0x00007ff69dd72d44 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x4962d44)
#&#8203;22 0x00007ff69dd72ecf (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x4962ecf)
#&#8203;23 0x00007ff69dd8eead (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x497eead)
#&#8203;24 0x00007ff88ec31bb2 (C:\WINDOWS\System32\ucrtbase.dll+0x21bb2)
#&#8203;25 0x00007ff8906a7034 (C:\WINDOWS\System32\KERNEL32.DLL+0x17034)
#&#8203;26 0x00007ff891542651 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x52651)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions