Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error (probably constexpr problem) #2478

Closed
mmarkeloff opened this issue Sep 1, 2021 · 4 comments
Closed

Compile error (probably constexpr problem) #2478

mmarkeloff opened this issue Sep 1, 2021 · 4 comments

Comments

@mmarkeloff
Copy link
Contributor

Hi!

I'm getting this error when trying to compile fmt.cpp:

$ cl -GR -EHsc /O2 /DNDEBUG /GS- /W3 /DWIN2K /DWIN32 /DLLP64 /DWINVER=0x501 /D_WIN32_WINNT=0x501 /DWINNT /D_BIND_TO_CUR
RENT_VCLIBS_VERSION /DYY_NO_UNISTD_H -DSPDLOG_COMPILED_LIB /I'include' /c 'src/fmt.cpp' /Fo'fmt.o'
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25547 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

fmt.cpp
...\spdlog\include\spdlog\fmt\bundled\core.h(2729): error C2131: expression did not evaluate to a constant
...\spdlog\include\spdlog\fmt\bundled\core.h(2729): note: a non-constant (sub-)expression was encountered
...\spdlog\include\spdlog\fmt\bundled\core.h(2848): note: see reference to function template instantiation 'void fmt::v8::detail::check_format_string<fmt::v8::string_view&,const char(&)[3],S,0>(S)' being compiled
        with
        [
            S=fmt::v8::detail::format_error_code::<lambda_0aa9e4657fec1b144ce80cc145d82a7f>::()::FMT_COMPILE_STRING
        ]
include\spdlog/fmt/bundled/format-inl.h(74): note: see reference to function template instantiation 'fmt::v8::basic_format_string<char,fmt::v8::string_view &,const char (&)[3]>::basic_format_string<fmt::v8::detail::format_error_code::<lambda_0aa9e4657fec1b144ce80cc145d82a7f>::()::FMT_COMPILE_STRING,0>(const S &)' being compiled
        with
        [
            S=fmt::v8::detail::format_error_code::<lambda_0aa9e4657fec1b144ce80cc145d82a7f>::()::FMT_COMPILE_STRING
        ]
include\spdlog/fmt/bundled/format-inl.h(74): note: see reference to function template instantiation 'fmt::v8::basic_format_string<char,fmt::v8::string_view &,const char (&)[3]>::basic_format_string<fmt::v8::detail::format_error_code::<lambda_0aa9e4657fec1b144ce80cc145d82a7f>::()::FMT_COMPILE_STRING,0>(const S &)' being compiled
        with
        [
            S=fmt::v8::detail::format_error_code::<lambda_0aa9e4657fec1b144ce80cc145d82a7f>::()::FMT_COMPILE_STRING
        ]
...\spdlog\include\spdlog\fmt\bundled\core.h(2729): fatal error C1903: unable to recover from previous error(s); stopping compilation

My environment:

  • Windows 10
  • __cplusplus 199711 (but my compiler supports cpp14 features (not cpp17))
  • WINVER 0x501 (also tried 0x600)
  • _WIN32_WINNT 0x501 (also tried 0x600)

I'm deleted ifndef branch, and it helps.

@vitaut
Copy link
Contributor

vitaut commented Sep 1, 2021

Looks like your compiler doesn't support relaxed constexpr. I guess the workaround would be to change FMT_MSC_VER >= 1910 (to FMT_MSC_VER >= 1912?) in

(FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VER >= 1910 || \

A PR would be welcome.

@mmarkeloff
Copy link
Contributor Author

Yeah, my _MSC_VER is 1911. Your fix is helps for me.

mmarkeloff added a commit to mmarkeloff/fmt that referenced this issue Sep 2, 2021
_MSC_VER 1911 (Visual Studio 2017 15.3)
vitaut pushed a commit that referenced this issue Sep 2, 2021
_MSC_VER 1911 (Visual Studio 2017 15.3)
@vitaut vitaut closed this as completed Sep 2, 2021
PoetaKodu pushed a commit to pacc-repo/fmt that referenced this issue Nov 11, 2021
_MSC_VER 1911 (Visual Studio 2017 15.3)
@tstrutz
Copy link

tstrutz commented Jan 27, 2022

I actually still encountered this problem on the current branch and am using _MSC_VER 1929. (VS2017 V15.7.6)

I had to increment the value of FMT_MSC_VER to 1930 to get it to avoid compiling the statements.

@ebrianne
Copy link

I actually still encountered this problem on the current branch and am using _MSC_VER 1929. (VS2017 V15.7.6)

I had to increment the value of FMT_MSC_VER to 1930 to get it to avoid compiling the statements.

Same here using fmt 9.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants