Boost C++ Libraries: Ticket #9266: Synchronized_value crashes MSVC12 (VS2013) https://svn.boost.org/trac10/ticket/9266 <p> I got the crash using the following full code (using boost trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/86347" title="Update 1.55 release notes, regenerate docs.">r86347</a> ): </p> <pre class="wiki"> #include&lt;boost/thread/synchronized_value.hpp&gt; boost::synchronized_value&lt;int&gt; foo; </pre><p> Which produce the following error (ignore the file name, it contains exactly the code above): </p> <pre class="wiki">1&gt; clock.cpp 1&gt;e:\projects\sdk\boost\boost\include\boost-1_55\boost\thread\synchronized_value.hpp(401): fatal error C1001: An internal error has occurred in the compiler. 1&gt; (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\types.c', line 12852) 1&gt; To work around this problem, try simplifying or changing the program near the locations listed above. 1&gt; Please choose the Technical Support command on the Visual C++ 1&gt; Help menu, or open the Technical Support help file for more information 1&gt; e:\projects\games\netrush\netrush_projects\projects\netrush\system\core\clock.hpp(120) : see reference to class template instantiation 'boost::synchronized_value&lt;int,boost::mutex&gt;' being compiled Build has been canceled. </pre><p> Note that I reported another problem similar in MSVC12 RC: connect.microsoft.com/VisualStudio/feedback/details/802157/compiler-crash-mixing-boost-synchronized-value-and-boost-property-tree I'm not sure if it's related. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9266 Trac 1.4.3 mjklaim@… Fri, 18 Oct 2013 17:40:17 GMT <link>https://svn.boost.org/trac10/ticket/9266#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:1</guid> <description> <p> Removing the ifdefs in the synchronized_value related to BOOST_NO_CXX11_VARIADIC_TEMPLATES, and taking the code using variadic templates does fix the problem for me. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 18 Oct 2013 18:00:43 GMT</pubDate> <title>owner, status, description changed https://svn.boost.org/trac10/ticket/9266#comment:2 https://svn.boost.org/trac10/ticket/9266#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/9266?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket viboes Fri, 18 Oct 2013 18:04:53 GMT <link>https://svn.boost.org/trac10/ticket/9266#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9266#comment:1" title="Comment 1">mjklaim@…</a>: </p> <blockquote class="citation"> <p> Removing the ifdefs in the synchronized_value related to BOOST_NO_CXX11_VARIADIC_TEMPLATES, and taking the code using variadic templates does fix the problem for me. </p> </blockquote> <p> Please, could you provide a patch that resolve the issue, I don't understand which part must be removed in your case. </p> </description> <category>Ticket</category> </item> <item> <author>mjklaim@…</author> <pubDate>Fri, 18 Oct 2013 18:20:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9266#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:4</guid> <description> <p> Sorry! I meant: </p> <ol><li>go into synchronized_value.hpp </li><li>search ifdefs testing BOOST_NO_CXX11_VARIADIC_TEMPLATES (there are 2 if I'm correct) </li><li>remove the ifdef and keep only the code that does use variadic templates. </li></ol><p> Then <code>boost::synchronized_value&lt;int&gt;</code> does compile for me. I also forgot to say that I'm using the last boost thread interface (V4?). </p> <p> I'm currently recompiling this revision of trunk boost with BOOST_NO_CXX11_VARIADIC_TEMPLATES defined only for MSVC &lt;= VC11 , see if it impacts my current code (I suspect it will break my signals2 usage as said in the mailing list but I want to be sure). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 18 Oct 2013 20:16:11 GMT</pubDate> <title>component changed https://svn.boost.org/trac10/ticket/9266#comment:5 https://svn.boost.org/trac10/ticket/9266#comment:5 <ul> <li><strong>component</strong> <span class="trac-field-old">thread</span> → <span class="trac-field-new">config</span> </li> </ul> <p> Whether BOOST_NO_CXX11_VARIADIC_TEMPLATES must be defined or not is out of the scope of Boost.Thread and we need to fix it in Boost.Config. </p> <p> Anyway it is a shame that Microsoft has not checked MSVC12 RC against the regression tests in boost before delivering. </p> Ticket mjklaim@… Fri, 18 Oct 2013 20:28:59 GMT <link>https://svn.boost.org/trac10/ticket/9266#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9266#comment:5" title="Comment 5">viboes</a>: </p> <blockquote class="citation"> <p> Anyway it is a shame that Microsoft has not checked MSVC12 RC against the regression tests in boost before delivering. </p> </blockquote> <p> That being said, synchronized_value worked correctly with MSVC12 RC, at least in the revision I used in the past months (which I believe was <a class="changeset" href="https://svn.boost.org/trac10/changeset/85663" title="Thread: merge scoped_thread constr + condition_variable timed wait ...">r85663</a> ). Yesterday I was still using this revision with MSVC12 RC and had no other problem than this one: connect.microsoft.com/VisualStudio/feedback/details/802157/compiler-crash-mixing-boost-synchronized-value-and-boost-property-tree </p> <p> I didn't check if something changed in config or synchronized_value since them so there are several potential source of problem here. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 18 Oct 2013 22:52:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9266#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:7</guid> <description> <p> The last commit in synchronized_value was <a class="changeset" href="https://svn.boost.org/trac10/changeset/85306" title="Thread: Added synchronized_value operator() to synchronize around a ...">[85306]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 13 Dec 2013 13:02:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9266#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9266#comment:8</guid> <description> <p> There's a message thread on the lists to the effect that variadic templates are not fully supported yet: <a class="ext-link" href="http://lists.boost.org/Archives/boost/2013/09/206389.php"><span class="icon">​</span>http://lists.boost.org/Archives/boost/2013/09/206389.php</a> so I'm reluctant to re-enable them in Boost.Config. Sounds like this is a good case where a BOOST_WORKAROUND would be more appropriate in the thread lib? </p> <p> BTW am I alone in finding it ironic that the way to work around a compiler bug is to enable an only-partially-working new feature? Oh well! </p> <p> The change I'm suggesting for synchronized_value.hpp is to change: </p> <pre class="wiki">#if ! defined BOOST_NO_CXX11_VARIADIC_TEMPLATES </pre><p> to </p> <pre class="wiki">#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || BOOST_WORKAROUND(BOOST_MSVC, == 1800) </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 18 Jun 2014 18:02:37 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9266#comment:9 https://svn.boost.org/trac10/ticket/9266#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> Update: this works for me with current develop and master branches and released VC12. </p> Ticket