boostorg / boostorg/core

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

Open
#204 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
156
Forks
116
PR merge metrics
No merged PRs in 30d

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.