Skip to content

numeric_limits.hpp error: "constexpr" is not valid here constexpr int min_exponent = std::numeric_limits<int>::min_exponent; #1383

@jrobcary

Description

@jrobcary

Compiling code with clang-cl from LLVM20. Code has cmake build system, compiled with C++17 standard.

Tons of errors like

D:\winsame\cary\dev1\contrib-llvm20_vs2022\boost-1_90.0-ser\include\boost/math/tools/numeric_limits.hpp(91): error: "constexpr" is not valid here
constexpr bool is_signed = std::numeric_limits::is_signed;

D:\winsame\cary\dev1\contrib-llvm20_vs2022\boost-1_90.0-ser\include\boost/math/tools/numeric_limits.hpp(92): error: "constexpr" is not valid here
constexpr bool is_integer = std::numeric_limits::is_integer;

A typical offending line:
BOOST_MATH_STATIC bool is_signed = std::numeric_limits<double>::is_signed;

It looks like this is coming from config.hpp:

#  ifndef BOOST_MATH_HAS_GPU_SUPPORT
#    define BOOST_MATH_INLINE_CONSTEXPR static constexpr
#    define BOOST_MATH_STATIC static
#    define BOOST_MATH_STATIC_LOCAL_VARIABLE
#  else
#    define BOOST_MATH_INLINE_CONSTEXPR constexpr.
#    define BOOST_MATH_STATIC constexpr <-------

I tried changing constexpr to static, but the code still fails to compile.

Is there a better way to deal with this?
Disable GPU in Boost?

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