Skip to content

Fix redefinition of function template#1638

Closed
wx257osn2 wants to merge 1 commit intoboostorg:developfrom
wx257osn2:fix-redefinition-of-function-template
Closed

Fix redefinition of function template#1638
wx257osn2 wants to merge 1 commit intoboostorg:developfrom
wx257osn2:fix-redefinition-of-function-template

Conversation

@wx257osn2
Copy link

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
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant