Skip to content

CUDA compilation fails with __builtin_is_constant_evaluated in boost/core/bit.hpp #204

Description

@Michael-Preisel

Description:

  • Boost Version: 1.89.0
  • CUDA Version: 12.6
  • MSVC Version: 2022 (1925+)
  • Error: "variable in constexpr function is uninitialized" for unsigned long r;

Root Cause:
Line 35 enables BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL for MSVC 1925+ but doesn't exclude CUDA compiler (nvcc), which has stricter constexpr requirements.

Proposed Fix:
Change line 42 from:
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925
to:
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925 && '!defined(__CUDACC__)'

Impact: Prevents CUDA compilation errors while maintaining optimization for regular MSVC builds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions