Skip to content

WinAdapter does not enable UUID emulation on clang when C++ extensions are disabled #7319

@Devaniti

Description

@Devaniti

Description
When using DXC headers with clang compiler, headers fail to compile if C++ extensions were explicitly disabled.

Steps to Reproduce

  1. In CMake project, set CMAKE_CXX_EXTENSIONS to OFF
  2. Include WinAdapter.h in that same CMake project
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crash

    Type

    No type

    Projects

    Status

    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions