microsoft / microsoft/WindowsAppSDK

Windows App SDK 1.7.3:`base.h` `#elif _DEBUG` gives build error C1017: invalid integer constant expression

Open
#5,507 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-External
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

#define CPPWINRT_VERSION "2.0.250303.1"

#if !defined(__cpp_lib_source_location) || defined(WINRT_NO_SOURCE_LOCATION)
// Case1: cpp17 mode. The source_location intrinsics are not available.
// Case2: The caller has disabled source_location support. Ensure that there is no binary size overhead for line/file/function.
#define WINRT_IMPL_BUILTIN_LINE 0
#define WINRT_IMPL_BUILTIN_FILE nullptr
#define WINRT_IMPL_BUILTIN_FUNCTION nullptr
#elif defined(_DEBUG)
// cpp20 _DEBUG builds include function information, which has a heavy binary size impact, in addition to file/line.
#define WINRT_IMPL_BUILTIN_LINE __builtin_LINE()
#define WINRT_IMPL_BUILTIN_FILE __builtin_FILE()
#define WINRT_IMPL_BUILTIN_FUNCTION __builtin_FUNCTION()
#else
// Release builds in cpp20 mode get file and line information but NOT function information. Function strings
// quickly add up to a substantial binary size impact, especially when templates are heavily used.
#define WINRT_IMPL_BUILTIN_LINE __builtin_LINE()
#define WINRT_IMPL_BUILTIN_FILE __builtin_FILE()
#define WINRT_IMPL_BUILTIN_FUNCTION nullptr
#endif

### Steps to reproduce the bug

_DEBUG is defined, but in a way that doesn't resolve to a valid integer constant expression:


_DEBUG;%(PreprocessorDefinitions)

### Expected behavior

_No response_

### Screenshots

_No response_

### NuGet package version

Windows App SDK 1.7.3: 1.7.250606001

### Packaging type

Unpackaged

### Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

### IDE

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating base.h and inspect the conditional that checks _DEBUG around the WINRT_IMPL_BUILTIN_* definitions. Reproduce the Windows App SDK 1.7.3 build with _DEBUG defined as shown; done means the project compiles without C1017 while preserving the intended debug and release behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.