Skip to content

Windows-latest Visual Studio 2022 / Windows 11 SDK has incorrect definition of NAN that breaks builds #12316

@julian-smith-artifex-com

Description

Description

With runner windows-latest (windows-2022), i'm seeing an incorrect compile failure error C2099: initializer is not a constant when compiling C code that uses NAN.

It looks like this is a known issue - see: https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907?pageSize=15&sort=active&topics=cppcompiler&q=__ucrt_int_to_float

According to that page:

A fix has been released and is available in the latest Windows SDK (Windows 11, Build 10.0.26100.3916), available here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

Could windows-2022 be updated accordingly?

Thanks.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

The project is not public, but here is the start of the logs containing the various version numbers etc:

2025-06-04T08:36:02.1060897Z Current runner version: '2.324.0'
2025-06-04T08:36:02.1097149Z ##[group]Operating System
2025-06-04T08:36:02.1098471Z Microsoft Windows Server 2022
2025-06-04T08:36:02.1099415Z 10.0.20348
2025-06-04T08:36:02.1100154Z Datacenter
2025-06-04T08:36:02.1100981Z ##[endgroup]
2025-06-04T08:36:02.1101771Z ##[group]Runner Image
2025-06-04T08:36:02.1102653Z Image: windows-2022
2025-06-04T08:36:02.1103662Z Version: 20250527.1.0
2025-06-04T08:36:02.1105501Z Included Software: https://github.com/actions/runner-images/blob/win22/20250527.1/images/windows/Windows2022-Readme.md
2025-06-04T08:36:02.1108189Z Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20250527.1
2025-06-04T08:36:02.1109802Z ##[endgroup]
2025-06-04T08:36:02.1110665Z ##[group]Runner Image Provisioner
2025-06-04T08:36:02.1111788Z 2.0.437.1
2025-06-04T08:36:02.1112802Z ##[endgroup]

Is it regression?

I don't know - i usually use windows-2019 but this is being phased out so moving to 2022.

Expected behavior

The compile should succeed.

Actual behavior

I get error C2099: initializer is not a constant for this code:

const fz_quad fz_invalid_quad = { {NAN, NAN}, {NAN, NAN}, {NAN, NAN}, {NAN, NAN} };

This code compiles fine on windows-2019, ubuntu-latest, macos-13, macos-14.

Repro steps

Compile C code that uses NAN in a const context.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions