Skip to content

cpp_redis does not compile with MSVC in conformance mode or with C++20  #122

@chriss5

Description

@chriss5

When building cpp_redis with Microsoft Visual Studio and switching the permissive mode off (=conformance mode on) or switching the language standard to C++20 (what implicitly enabled the conformacne mode), cpp_redis no longer compiles due to an error in optional.hpp when explanding __CPP_REDIS_LOG(1, "value_or(U&& v)\n") to cpp_redis::1(...)
Error C2589 'constant': illegal token on right side of '::'

The reason is that MSVC by default sets the __cplusplus makro to 199711L even for newer language standards.

The solution is to either set an additional compiler option in the visual studio project: /Zc:__cplusplus or to update the line
#if __cplusplus >= 201703L in optional.hpp to also check for _MSVC_LANG

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions