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

Fix redefinition of function template #1638

Closed
wants to merge 1 commit into from

Conversation

@wx257osn2
Copy link

wx257osn2 commented Jun 16, 2019

In MSVC, I've got compile error like below (sorry, I'm Japanese so the error messages are Japanese):

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\ssl\ssl_stream.hpp(663): error C2995: 'void boost::beast::teardown(boost::beast::role_type,boost::beast::ssl_stream<NextLayer> &,boost::system::error_code &)': 関数テンプレートは既に定義されています
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\ssl\ssl_stream.hpp(655): note: 'boost::beast::teardown' の宣言を確認してください
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\core\stream_traits.hpp(114): note: コンパイル対象の クラス テンプレート インスタンス化 'boost::beast::ssl_stream<boost::asio::ip::tcp::socket>' のリファレンスを確認してください
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\websocket\stream.hpp(174): note: コンパイル対象の エイリアス テンプレート インスタンス化 'boost::beast::executor_type<boost::beast::ssl_stream<boost::asio::ip::tcp::socket>>' のリファレンスを確認してください
1>R:\boost.beast.example\BoostBeastExample\Source.cpp(148): note: コンパイル対象の クラス テンプレート インスタンス化 'boost::beast::websocket::stream<boost::beast::ssl_stream<boost::asio::ip::tcp::socket>,true>' のリファレンスを確認してください
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\xstring(1670): note: コンパイル対象の クラス テンプレート インスタンス化 'std::basic_string_view<char,std::char_traits<char>>' のリファレンスを確認してください
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\ssl\ssl_stream.hpp(677): error C2995: 'void boost::beast::async_teardown(boost::beast::role_type,boost::beast::ssl_stream<NextLayer> &,TeardownHandler &&)': 関数テンプレートは既に定義されています
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\boost\beast\ssl\ssl_stream.hpp(668): note: 'boost::beast::async_teardown' の宣言を確認してください

Well, the messages says that the functions boost::beast::teardown and boost::beast::teardown_async were redefined despite the functions had already defined.
It seems that the friend functions were redefined when the ssl_stream was instantiated more than once with each different type parameters like boost::beast::ssl_stream<boost::beast::tcp_stream> and boost::beast::ssl_stream<boost::asio::ip::tcp::socket> .

This PR fixes this issue.

@wx257osn2

This comment has been minimized.

Copy link
Author

wx257osn2 commented Jun 16, 2019

Oops, it had been already fixed at 1de60a0 ...
I'll wait for next release.

@wx257osn2 wx257osn2 closed this Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.