chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.9k stars 1.21k forks source link

Cannot compile 1.72.0 on Windows using Visual Studio 2019 with /std:c++latest #747

Open ghost opened 3 years ago

ghost commented 3 years ago

@felixhao28 commented on Feb 6, 2020, 7:25 AM UTC:

The source of boost library is acquired from https://www.boost.org/users/history/version_1_72_0.html .

As the title indicates, compilation fails on boost 1.72.0 while 1.71.0 works fine with /std:c++latest on Visual Studio 2019. And /std:c++17 works fine too.

Not sure this is a bug with Visual Studio or boost library. I opened an issue for Visual Studio team, too.

This issue was moved by chriskohlhoff from boostorg/asio#325.

ghost commented 3 years ago

@kartikeytewari commented on Feb 6, 2020, 8:54 AM UTC:

ghost commented 3 years ago

@felixhao28 commented on Feb 6, 2020, 9:48 AM UTC:

It prints a lot of errors. The first ones are:

1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file PythonPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,30): error C7568: argument list missing after assumed function template 'callable_with' (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(58): message : see reference to class template instantiation 'boost::asio::detail::is_completion_handler_for<T,R(Args...)>' being compiled (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file PythonPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,30): error C7568: argument list missing after assumed function template 'callable_with' (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(58): message : see reference to class template instantiation 'boost::asio::detail::is_completion_handler_for<T,R(Args...)>' being compiled (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file PredictionBase.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,2): error C2059: syntax error: '>' (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file PythonPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,30): error C7568: argument list missing after assumed function template 'callable_with' (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(58): message : see reference to class template instantiation 'boost::asio::detail::is_completion_handler_for<T,R(Args...)>' being compiled (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected (compiling source file UtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,2): error C2059: syntax error: '>' (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file PredictionBase.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(57,1): error C3770: 'unknown-type': is not a valid base class (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,30): error C7568: argument list missing after assumed function template 'callable_with' (compiling source file PythonPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(58): message : see reference to class template instantiation 'boost::asio::detail::is_completion_handler_for<T,R(Args...)>' being compiled (compiling source file PythonPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,2): error C2059: syntax error: '>' (compiling source file ExecutorTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{' (compiling source file UtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(57,1): error C3770: 'unknown-type': is not a valid base class (compiling source file LangUtilsTest.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file PredictionBase.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(63,1): error C2062: type 'bool' unexpected (compiling source file JavaPredictionTests.cpp)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,2): error C2059: syntax error: '>' (compiling source file PythonPredictionTests.cpp)

image

The error is definitely reproducible. Another coworker of mine also faces the same issue.

ghost commented 3 years ago

@felixhao28 commented on Feb 6, 2020, 9:50 AM UTC:

The full error log for reference: boost1.72.0vscppstdlatest.txt

ghost commented 3 years ago

@felixhao28 commented on Feb 6, 2020, 9:53 AM UTC:

I found a minimal reproducible case:

#include <boost/asio.hpp>

int main() {
    return 0;
}

Compiling this with /std:c++latest gives:

image

1>------ Build started: Project: Project1, Configuration: Debug x64 ------
1>Source.cpp
1>Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
1>- add -D_WIN32_WINNT=0x0601 to the compiler command line; or
1>- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
1>Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(44,1): error C2062: type 'bool' unexpected
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2143: syntax error: missing ';' before '{'
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(45,1): error C2447: '{': missing function header (old-style formal list?)
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,30): error C7568: argument list missing after assumed function template 'callable_with'
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(58): message : see reference to class template instantiation 'boost::asio::detail::is_completion_handler_for<T,R(Args...)>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\chrono(632): message : see reference to class template instantiation 'std::chrono::duration<double,std::ratio<1,1>>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\chrono(178): message : see reference to class template instantiation 'std::chrono::duration<__int64,std::nano>' being compiled
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\chrono(610): message : see reference to class template instantiation 'std::chrono::time_point<std::chrono::steady_clock,std::chrono::nanoseconds>' being compiled
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(56,2): error C2059: syntax error: '>'
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(57,1): error C3770: 'unknown-type': is not a valid base class
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(63,1): error C2062: type 'bool' unexpected
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(64,35): error C2065: 'T': undeclared identifier
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(64,11): error C2923: 'boost::asio::detail::is_completion_signature': 'T' is not a valid template type argument for parameter 'T'
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(64,39): error C2955: 'boost::asio::detail::is_completion_signature': use of class template requires template argument list
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(34): message : see declaration of 'boost::asio::detail::is_completion_signature'
1>D:\dev\boost_1_72_0\boost\asio\async_result.hpp(69,44): error C2061: syntax error: identifier 'completion_signature'
...
ghost commented 3 years ago

@felixhao28 commented on Feb 10, 2020, 1:59 AM UTC:

This might be a duplicate of #312

ghost commented 3 years ago

@velia-ai commented on Mar 25, 2020, 10:29 AM UTC:

I experienced the exact same problem and confirm that boost 1.72.0 w/ VS-2019 compiled fine when the language flag is set to /std:c++17 but failed when set to /std:c++latest