Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have found Clang to generate the best error messages for heavily templated code. Of course verbosity is unavoidable in most cases, but it's still better than GCC or MSVC most of the time. Here's the Clang error message for the example code posted by AshleysBrain:</p> <pre><code>$ clang++ -std=c++11 -stdlib=libc++ -o dummy dummy.cpp In file included from dummy.cpp:1: In file included from /usr/include/c++/v1/vector:243: In file included from /usr/include/c++/v1/__bit_reference:15: In file included from /usr/include/c++/v1/algorithm:594: /usr/include/c++/v1/memory:1425:36: error: calling a private constructor of class 'std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt;' ::new ((void*)__p) _Tp(_STD::forward&lt;_Args&gt;(__args)...); ^ /usr/include/c++/v1/memory:1358:14: note: in instantiation of function template specialization 'std::__1::allocator_traits&lt;std::__1::allocator&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &gt; &gt;::__construct&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt;, std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &amp;&gt;' requested here {__construct(__has_construct&lt;allocator_type, pointer, _Args...&gt;(), ^ /usr/include/c++/v1/vector:781:25: note: in instantiation of function template specialization 'std::__1::allocator_traits&lt;std::__1::allocator&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &gt; &gt;::construct&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt;, std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &amp;&gt;' requested here __alloc_traits::construct(__a, _STD::__to_raw_pointer(this-&gt;__end_), *__first); ^ /usr/include/c++/v1/vector:924:9: note: in instantiation of function template specialization 'std::__1::vector&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt;, std::__1::allocator&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &gt; &gt;::__construct_at_end&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; *&gt;' requested here __construct_at_end(__x.__begin_, __x.__end_); ^ dummy.cpp:7:37: note: in instantiation of member function 'std::__1::vector&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt;, std::__1::allocator&lt;std::__1::unique_ptr&lt;int, std::__1::default_delete&lt;int&gt; &gt; &gt; &gt;::vector' requested here std::vector&lt;unique_ptr&lt;int&gt;&gt; bar = foo; ^ /usr/include/c++/v1/memory:1997:5: note: declared private here unique_ptr(const unique_ptr&amp;); ^ 1 error generated. </code></pre> <p>It's still long and ugly, but in my opinion much clearer regarding what/where the problem is.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload