Boost C++ Libraries: Ticket #7367: Ambiguity with nested list_of on C++11/C++0x compilers https://svn.boost.org/trac10/ticket/7367 <p> The following code compiles in VS2010, however when compiled with VS2012 or GCC 4.7.1 it no longer compiles. </p> <pre class="wiki"> #include "stdafx.h" #include &lt;string&gt; #include &lt;vector&gt; #include &lt;boost/assign.hpp&gt; using namespace std; typedef wstring IssueInfo; typedef vector&lt;IssueInfo&gt; IssuesAndFixes; typedef pair&lt;wstring, IssuesAndFixes&gt; IssueCategoryEntry; typedef vector&lt;IssueCategoryEntry&gt; IssuesAndFixesMap; extern const IssuesAndFixesMap kIssuesAndFixes; IssuesAndFixes dummy; const IssuesAndFixesMap kIssuesAndFixes = boost::assign::list_of&lt;IssueCategoryEntry&gt; ( wstring(), boost::assign::list_of&lt;IssueInfo&gt; ( ) ); int main() { return 0; } </pre><p> Error in GCC is: </p> <pre class="wiki"> Compilation finished with errors: In file included from include/c++/4.7.1/bits/stl_algobase.h:65:0, from include/c++/4.7.1/bits/char_traits.h:41, from include/c++/4.7.1/string:42, from source.cpp:1: include/c++/4.7.1/bits/stl_pair.h: In instantiation of 'constexpr std::pair&lt;_T1, _T2&gt;::pair(const _T1&amp;, _U2&amp;&amp;) [with _U2 = const boost::assign_detail::generic_list&lt;std::basic_string&lt;wchar_t&gt; &gt;&amp;; &lt;template-parameter-2-2&gt; = void; _T1 = std::basic_string&lt;wchar_t&gt;; _T2 = std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt;]': boost/preprocessor/iteration/detail/local.hpp:37:1: required from 'boost::assign_detail::generic_list&lt;T&gt;&amp; boost::assign_detail::generic_list&lt;T&gt;::operator()(const U&amp;, const U0&amp;) [with U = std::basic_string&lt;wchar_t&gt;; U0 = boost::assign_detail::generic_list&lt;std::basic_string&lt;wchar_t&gt; &gt;; T = std::pair&lt;std::basic_string&lt;wchar_t&gt;, std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt; &gt;; boost::assign_detail::generic_list&lt;T&gt; = boost::assign_detail::generic_list&lt;std::pair&lt;std::basic_string&lt;wchar_t&gt;, std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt; &gt; &gt;]' boost/preprocessor/iteration/detail/local.hpp:37:1: required from 'boost::assign_detail::generic_list&lt;T&gt; boost::assign::list_of(const U&amp;, const U0&amp;) [with T = std::pair&lt;std::basic_string&lt;wchar_t&gt;, std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt; &gt;; U = std::basic_string&lt;wchar_t&gt;; U0 = boost::assign_detail::generic_list&lt;std::basic_string&lt;wchar_t&gt; &gt;]' source.cpp:25:3: required from here include/c++/4.7.1/bits/stl_pair.h:137:45: error: call of overloaded 'vector(const boost::assign_detail::generic_list&lt;std::basic_string&lt;wchar_t&gt; &gt;&amp;)' is ambiguous include/c++/4.7.1/bits/stl_pair.h:137:45: note: candidates are: In file included from include/c++/4.7.1/vector:65:0, from source.cpp:2: include/c++/4.7.1/bits/stl_vector.h:361:7: note: std::vector&lt;_Tp, _Alloc&gt;::vector(std::initializer_list&lt;_Tp&gt;, const allocator_type&amp;) [with _Tp = std::basic_string&lt;wchar_t&gt;; _Alloc = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;; std::vector&lt;_Tp, _Alloc&gt;::allocator_type = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;] include/c++/4.7.1/bits/stl_vector.h:324:7: note: std::vector&lt;_Tp, _Alloc&gt;::vector(std::vector&lt;_Tp, _Alloc&gt;&amp;&amp;) [with _Tp = std::basic_string&lt;wchar_t&gt;; _Alloc = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;; std::vector&lt;_Tp, _Alloc&gt; = std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt;] include/c++/4.7.1/bits/stl_vector.h:307:7: note: std::vector&lt;_Tp, _Alloc&gt;::vector(const std::vector&lt;_Tp, _Alloc&gt;&amp;) [with _Tp = std::basic_string&lt;wchar_t&gt;; _Alloc = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;; std::vector&lt;_Tp, _Alloc&gt; = std::vector&lt;std::basic_string&lt;wchar_t&gt; &gt;] include/c++/4.7.1/bits/stl_vector.h:266:7: note: std::vector&lt;_Tp, _Alloc&gt;::vector(std::vector&lt;_Tp, _Alloc&gt;::size_type) [with _Tp = std::basic_string&lt;wchar_t&gt;; _Alloc = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;; std::vector&lt;_Tp, _Alloc&gt;::size_type = unsigned int] include/c++/4.7.1/bits/stl_vector.h:254:7: note: std::vector&lt;_Tp, _Alloc&gt;::vector(const allocator_type&amp;) [with _Tp = std::basic_string&lt;wchar_t&gt;; _Alloc = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;; std::vector&lt;_Tp, _Alloc&gt;::allocator_type = std::allocator&lt;std::basic_string&lt;wchar_t&gt; &gt;] </pre><p> Adding a <strong>to_container(dummy)</strong> call on the second list_of fixes the issue though. </p> <p> Example: liveworkspace.org/code/38e5fafed72adf0730ad71ebb599c97e </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7367 Trac 1.4.3 Eric Niebler Wed, 19 Sep 2012 15:23:53 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7367#comment:1 https://svn.boost.org/trac10/ticket/7367#comment:1 <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">duplicate</span> </li> </ul> <p> Dupe of <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/7364"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/7364</a> </p> Ticket