microsoft / microsoft/DirectXShaderCompiler
WinAdapter does not enable UUID emulation on clang when C++ extensions are disabled
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
When using DXC headers with clang compiler, headers fail to compile if C++ extensions were explicitly disabled.
Steps to Reproduce
- In CMake project, set
CMAKE_CXX_EXTENSIONStoOFF - Include WinAdapter.h in that same CMake project
- Try to build the project and observe compile error
Not tested on Linux, but same bug likely exists there as well.
Workaround is to add #define __EMULATE_UUID 1 before including any DXC headers.
Actual Behavior
When including WinAdapter.h, line CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046") produces following errors:
error: expected parameter declarator
572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
REDACTED/DXC/inc/WinAdapter.h:572:33: error: expected ')'
REDACTED/DXC/inc/WinAdapter.h:572:1: note: to match this '('
572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
REDACTED/DXC/inc/WinAdapter.h:552:25: note: expanded from macro 'CROSS_PLATFORM_UUIDOF'
552 | struct __declspec(uuid(spec)) interface;
| ^
REDACTED/DXC/inc/WinAdapter.h:572:23: error: expected function body after function declarator
572 | CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046")
Environment
- DXC version - v1.8.2502
- Host Operating System - macOS 15.4
- Compiler - AppleClang 17.0.0.17000013
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect inc/WinAdapter.h around lines 552 and 572, then reproduce the failure in a CMake project with CMAKE_CXX_EXTENSIONS set to OFF and AppleClang. Compare the behavior with the documented __EMULATE_UUID workaround. Done means a project including WinAdapter.h compiles without requiring that workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100