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

[VS2019] Fails to compile after commit f57227a148f19723fe3c7b601c25f1d9f48ee079 #1186

Closed
arthurdead opened this issue Jun 1, 2019 · 12 comments · Fixed by #1191
Closed

[VS2019] Fails to compile after commit f57227a148f19723fe3c7b601c25f1d9f48ee079 #1186

arthurdead opened this issue Jun 1, 2019 · 12 comments · Fixed by #1191

Comments

@arthurdead
Copy link

VS2019 16.0.28625.61
MSVC 14.21.27702

Compile Log (big)
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993:  'fmt::v5::internal::value': illegal type for non-type template parameter 'B'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993: FMT_CONSTEXPR11 init<C, basic_string_view<typename C::char_type>, string_type>
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1312,1): error C2993:  'fmt::v5::internal::value': illegal type for non-type template parameter '_Test'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1312,1): error C2993:     typename std::enable_if<internal::is_string<S>::value,
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1312,1): error C2993: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1356): message :  see reference to alias template instantiation 'fmt::v5::char_t<S>' being compiled
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1356): message : inline format_arg_store<typename buffer_context<FMT_CHAR(S)>::type, Args...>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\filesystem(2072): message :  see reference to class template instantiation 'std::chrono::time_point<std::filesystem::_File_time_clock,std::filesystem::_File_time_clock::duration>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\filesystem(2072): message :         _NODISCARD static time_point now() noexcept { // get current time; undo epoch adjustment
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\xstring(1715): message :  see reference to class template instantiation 'std::basic_string_view<wchar_t,std::char_traits<wchar_t>>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\xstring(1715): message :             const wchar_t* _Str, size_t _Len) noexcept { // construct wstring_view from [_Str, _Str + _Len)
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1313,66): error C2039:  'type': is not a member of 'std'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1313,66): error C2039:                             typename internal::char_t<S>::type>::type;
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1313,66): error C2039:                                                                  ^
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\string(19): message :  see declaration of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\string(19): message : _STD_BEGIN
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2062:  type 'unknown-type' unexpected
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2062: inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2062: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2143:  syntax error: missing ';' before '{'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2143: inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2143: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2447:  '{': missing function header (old-style formal list?)
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2447: inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1389,1): error C2447: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): warning C4346:  'fmt::v5::is_contiguous<Container>::value': dependent name is not a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): warning C4346:            basic_format_args<typename buffer_context<FMT_CHAR(S)>::type> args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): warning C4346: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): message :  prefix with 'typename' to indicate a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): message :            basic_format_args<typename buffer_context<FMT_CHAR(S)>::type> args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,1): message : ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,68): error C2146:  syntax error: missing '>' before identifier 'type'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,68): error C2146:            basic_format_args<typename buffer_context<FMT_CHAR(S)>::type> args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1411,68): error C2146:                                                                    ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): warning C4346:  'fmt::v5::internal::is_string<S>::value': dependent name is not a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): warning C4346: inline std::basic_string<FMT_CHAR(S)> format(const S& format_str,
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): warning C4346: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): message :  prefix with 'typename' to indicate a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): message : inline std::basic_string<FMT_CHAR(S)> format(const S& format_str,
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): message : ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): error C2062:  type 'unknown-type' unexpected
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): error C2062: inline std::basic_string<FMT_CHAR(S)> format(const S& format_str,
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1448,1): error C2062: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2143:  syntax error: missing ';' before '{'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2143:                                              const Args&... args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2143: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2447:  '{': missing function header (old-style formal list?)
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2447:                                              const Args&... args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(1449,1): error C2447: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(1802,1): error C2955:  'fmt::v5::basic_string_view': use of class template requires template argument list
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(1802,1): error C2955:   FMT_CONSTEXPR basic_string_view<FMT_CHAR(S)> to_view(S&& str) const {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(1802,1): error C2955: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(374): message :  see declaration of 'fmt::v5::basic_string_view'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(374): message : template <typename Char> class basic_string_view {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C4430:  missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C4430:     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C4430: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): warning C4346:  'fmt::v5::internal::is_output_iterator<OutputIt>::value': dependent name is not a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): warning C4346:     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): warning C4346: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): message :  prefix with 'typename' to indicate a type
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): message :     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): message : ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,62): error C2146:  syntax error: missing ')' before identifier 'args'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,62): error C2146:     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,62): error C2146:                                                              ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C3646:  'args': unknown override specifier
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C3646:     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C3646: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C2059:  syntax error: ')'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C2059:     typename format_args_t<OutputIt, FMT_CHAR(String)>::type args) {
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3459,1): error C2059: ^
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3462,71): error C3861:  'args': identifier not found
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3462,71): error C3861:                                           to_string_view(format_str), args);
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/format.h(3462,71): error C3861:   
@arthurdead arthurdead changed the title [VS2019] Fails to compile after commit f57227a148f19723fe3c7b601c25f1d9f48ee079 [VS2019] Fails to compile after commit #f57227a148f19723fe3c7b601c25f1d9f48ee079 Jun 1, 2019
@arthurdead arthurdead changed the title [VS2019] Fails to compile after commit #f57227a148f19723fe3c7b601c25f1d9f48ee079 [VS2019] Fails to compile after commit f57227a148f19723fe3c7b601c25f1d9f48ee079 Jun 1, 2019
@vitaut
Copy link
Contributor

vitaut commented Jun 1, 2019

I wasn't able to repro it: https://ci.appveyor.com/project/vitaut/fmt/builds/24972186/job/56ptnunfmh77ushi

Moreover, the lines don't seem to match revision f57227, e.g.

is an empy line. Perhaps you are using a different revision?

@arthurdead
Copy link
Author

no it is in the f57227a commit

HEAD is now at f57227a FMT_ENABLE_IF -> enable_if_t

1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993:  'fmt::v5::internal::value': illegal type for non-type template parameter 'B'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993: FMT_CONSTEXPR11 init<C, basic_string_view<typename C::char_type>, string_type>
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(878,1): error C2993: ^

i will try the latest one

@arthurdead
Copy link
Author

same thing

HEAD is now at 67feef5 Make enable_if_t more std-like and move to fmt namespace

1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(882,1): error C2993:  'fmt::v5::internal::value': illegal type for non-type template parameter 'B'
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(882,1): error C2993: FMT_CONSTEXPR11 init<C, basic_string_view<typename C::char_type>, string_type>
1>D:\TheCode3\thirdparty\fmtlib\include\fmt/core.h(882,1): error C2993: ^

@vitaut
Copy link
Contributor

vitaut commented Jun 1, 2019

Please provide a repro example.

@arthurdead
Copy link
Author

fmtlib_die.cpp

#include "thirdparty/fmtlib/include/fmt/core.h"

int main()
{

}

cl.exe fmtlib_die.cpp /permissive- /diagnostics:caret

Microsoft (R) C/C++ Optimizing Compiler Version 19.21.27702.2 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

fmtlib_die.cpp
D:\TheCode3\thirdparty/fmtlib/include/fmt/core.h(882,1): error C2993: 'fmt::v5::internal::value': illegal type for non-type template parameter 'B'
FMT_CONSTEXPR11 init<C, basic_string_view<typename C::char_type>, string_type>
^

@mocabe
Copy link
Contributor

mocabe commented Jun 2, 2019

Probably related to issue #1140 and fix #1150 which I implemented.
Several notes about #1150:

  • To fix Compile Error VS2019 #1140, extra parentheses are needed around conditional parameter of enable_if.
  • Parentheses are required on both declaration and definition because it affects linker name on gcc/clang.
  • To make things work under these constraints, I added FMT_ENABLE_IF for declarations, and FMT_ENABLE_IF_T for definitions.

Haven't read changes yet so might be wrong, though.

@arthurdead
Copy link
Author

yep changing

#define FMT_ENABLE_IF(...) enable_if_t<__VA_ARGS__, int> = 0

to

#define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0

fixed compiling

@mocabe
Copy link
Contributor

mocabe commented Jun 2, 2019

@vitaut Should I write PR to fix it? Possibly revert f57227a and 67feef5.

@vitaut
Copy link
Contributor

vitaut commented Jun 2, 2019

Should I write PR to fix it?

Yes, please.

Possibly revert f57227a and 67feef5.

I'd rather avoid reverting these. Can we just add extra parentheses?

Also I wonder why it is not caught by AppVeyor? I added MSCV2019 there but it happily compiles the code in question.

@stevenhoving
Copy link
Contributor

stevenhoving commented Jun 2, 2019

possibly because the reproduction example supplied is using the /permissive- compiler flag. As I remember correctly that triggers the compiler to use its modern front-end. https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=vs-2019
And as far as I can see, your AppVeyor config does not set this flag.

@mocabe
Copy link
Contributor

mocabe commented Jun 3, 2019

I'd rather avoid reverting these. Can we just add extra parentheses?

Probably we can. But we need to add parentheses on every use of FMT_ENABLE_IF and it's definitions.
Or we can add parentheses in FMT_ENABLE_IF then add missing ones on definitions too.
I still prefer #1150 way of fix because it allows us to control parentheses at single point in FMT_ENABLE_IF_T.
Anyways, I'd follow what @vitaut wants.

Also I wonder why it is not caught by AppVeyor? I added MSCV2019 there but it happily compiles the code in question.

Not sure this is related to this issue, but AppVeyor also supports preview image of VS2019 as Visual Studio 2019 Preview as far as I can remember. Should we add it to CI configuration too?

@vitaut
Copy link
Contributor

vitaut commented Jun 3, 2019

possibly because the reproduction example supplied is using the /permissive- compiler flag.

Doesn't seem so, at least not on v19.20: https://godbolt.org/z/uceqRl

Should we add it to CI configuration too?

MSVC builds are extremely slow, so maybe only as a single config (without Debug/Release 32/64 variations).

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

Successfully merging a pull request may close this issue.

4 participants