Boost C++ Libraries: Ticket #12123: Using Boost.Signals2 with Boost.Variant leads to compilation error, MSVC 14 (suspected compiler bug) https://svn.boost.org/trac10/ticket/12123 <p> Attempting to compile a program that has a signal with a function type taking a variant as a parameter (e.g. boost::signals2::signal&lt;void(const boost::variant&lt;int&gt;)&gt;), and then calling said signal after it has been connected to something leads to a compilation failure for MSVC 14, Visual Studio 2015 Update 2. The actual error is rather long, but has to do with the compiler failing to disambiguate the type of the argument related to variants. I will be attaching a reduced version of the program that causes the compilation failure on MSVC 14 and also the error log I get. </p> <p> This program is compiled correctly on GCC 5.3, which is why I think this is a compiler bug. I've already filed a bug report/ticket with Microsoft just in case. Could this be worked around in any way? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12123 Trac 1.4.3 Gabriel Marcano <gmarcano@…> Tue, 12 Apr 2016 18:47:14 GMT attachment set https://svn.boost.org/trac10/ticket/12123 https://svn.boost.org/trac10/ticket/12123 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">error.log</span> </li> </ul> Ticket Gabriel Marcano <gmarcano@…> Tue, 12 Apr 2016 18:47:49 GMT attachment set https://svn.boost.org/trac10/ticket/12123 https://svn.boost.org/trac10/ticket/12123 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Source.cpp</span> </li> </ul> <p> Reduced sample code illustrating code that fails to compile </p> Ticket Gabriel Marcano <gmarcano@…> Tue, 12 Apr 2016 22:09:05 GMT <link>https://svn.boost.org/trac10/ticket/12123#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12123#comment:1</guid> <description> <p> After more troubleshooting today, I am unsure whether the problem lies within Boost.Signals2 or Boost.Variant. I was able to reproduce the problem with just Boost.Variant in my project, but I was unable to reproduce it without Boost.Signals2 in a reduced test case. This seems to hint that the problem lies more with Boost.Variant, although I will leave the component as Boost.Signals2 until someone with more knowledge can determine that. </p> <p> While doing more reading and testing, could this issue be related to the infamous MSVC extension allowing for temporary variables to bind to non-const references? I am able to compile the program in MSVC by using this extension (making parameters be non-const references). </p> </description> <category>Ticket</category> </item> <item> <author>raad@…</author> <pubDate>Thu, 14 Apr 2016 21:28:47 GMT</pubDate> <title>cc changed https://svn.boost.org/trac10/ticket/12123#comment:2 https://svn.boost.org/trac10/ticket/12123#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">raad@…</span> added </li> </ul> <p> The problem is boost::variant's unconstrained templated constructor, which cannot be used in C++17's std::tuple. </p> <p> There are two related boost::varant bug reports: <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/5871"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/5871</a> <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/11602"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/11602</a> </p> <p> The problem mentioned in a Visual C++ blog post: <a class="ext-link" href="https://blogs.msdn.microsoft.com/vcblog/2016/04/14/stl-fixes-in-vs-2015-update-2/"><span class="icon">​</span>https://blogs.msdn.microsoft.com/vcblog/2016/04/14/stl-fixes-in-vs-2015-update-2/</a> </p> Ticket tschenser@… Tue, 19 Apr 2016 07:08:22 GMT <link>https://svn.boost.org/trac10/ticket/12123#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12123#comment:3</guid> <description> <p> boost::any seems to have the same unconstrained template constructor, see my problem report <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/12110"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/12110</a>. </p> <p> As a possible workarround I may suggest you to to #define BOOST_NO_CXX11_HDR_TUPLE </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Frank Mori Hess</dc:creator> <pubDate>Fri, 22 Apr 2016 05:51:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12123#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12123#comment:4</guid> <description> <blockquote> <p> This patch seems to have fixed the similar issue reported in <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12110" title="#12110: Bugs: boost::signals2 with reference to boost::any crashes on vc2015 update2 (closed: fixed)">#12110</a> : </p> </blockquote> <p> <a class="ext-link" href="https://github.com/boostorg/signals2/commit/db0d3f55cccb2dbd8ab88a146af9100f2fca740b"><span class="icon">​</span>https://github.com/boostorg/signals2/commit/db0d3f55cccb2dbd8ab88a146af9100f2fca740b</a> </p> </description> <category>Ticket</category> </item> <item> <author>raad@…</author> <pubDate>Fri, 22 Apr 2016 07:02:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12123#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12123#comment:5</guid> <description> <p> I can confirm this fixes the problem with boost::variant for me. Thanks a lot! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Frank Mori Hess</dc:creator> <pubDate>Sun, 15 May 2016 04:21:20 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12123#comment:6 https://svn.boost.org/trac10/ticket/12123#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Changes merged to master, was fixed for 1.61 release. </p> Ticket