<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - std::pair: incomplete type error in template class instantiation."
href="http://llvm.org/bugs/show_bug.cgi?id=16801">16801</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::pair: incomplete type error in template class instantiation.
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>igor.solovyov@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Please, see bellow the minimal example which shows the problem.
It was compiled by Clang 3.3 as
"clang++ -std=c++11 -stdlib=libc++ -lc++abi 1.cpp -o 1.exe".
It looks very similar to <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - STL and incomplete types problem with libc++, works without libc++"
href="show_bug.cgi?id=13471">Bug #13471</a>.
The difference is at the instantiation point all involved types are defined
completely.
Without "-std=c++11" or -stdlib++ option no compilation errors happen.
====== Example: =========
#include <map>
template <typename K, typename V>
struct C
{
struct c;
typedef std::map<K, c> mmap;
struct c
{
V v_;
typename mmap::iterator i_;
};
mmap m_;
};
int main()
{
C<char, int> cc;
return 0;
}
============= Output: ==============
In file included from 1.cpp:1:
In file included from /usr/include/c++/v1/map:371:
In file included from /usr/include/c++/v1/__tree:16:
In file included from /usr/include/c++/v1/memory:594:
/usr/include/c++/v1/utility:222:9: error: field has incomplete type 'C<char,
int>::c'
_T2 second;
^
/usr/include/c++/v1/__tree:603:16: note: in instantiation of template class
'std::__1::pair<char, C<char, int>::c>' requested here
value_type __value_;
^
/usr/include/c++/v1/__tree:625:22: note: in instantiation of template class
'std::__1::__tree_node<std::__1::pair<char, C<char, int>::c>, void *>'
requested here
typedef typename __node::base __node_base;
^
/usr/include/c++/v1/map:542:19: note: in instantiation of template class
'std::__1::__tree_iterator<std::__1::pair<char, C<char, int>::c>,
std::__1::__tree_node<std::__1::pair<char, C<char, int>::c>, void *> *,
long>' requested here
_TreeIterator __i_;
^
1.cpp:12:29: note: in instantiation of template class
'std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::pair<char,
C<char, int>::c>,
std::__1::__tree_node<std::__1::pair<char, C<char, int>::c>, void *> *,
long> >' requested here
typename mmap::iterator i_;
^
/usr/include/c++/v1/type_traits:1836:27: note: in instantiation of member class
'C<char, int>::c' requested here
decltype(__is_constructible_test(declval<_Tp>(),
declval<_Args>()...))
^
/usr/include/c++/v1/type_traits:1885:14: note: (skipping 1 context in
backtrace; use -ftemplate-backtrace-limit=0 to see all)
: public __is_constructible<is_scalar<_Tp>::value ||
is_reference<_Tp>::value,
^
/usr/include/c++/v1/type_traits:1911:14: note: in instantiation of template
class 'std::__1::__is_constructible_void_check<false,
std::__1::allocator<std::__1::pair<const char, C<char, int>::c> >, >'
requested here
: public __is_constructible_void_check<__contains_void<_Tp,
_Args...>::value
^
/usr/include/c++/v1/type_traits:2391:34: note: in instantiation of template
class
'std::__1::is_constructible<std::__1::allocator<std::__1::pair<const
char, C<char, int>::c> >, >' requested here
: __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp,
_Args...>
^
/usr/include/c++/v1/type_traits:2513:14: note: in instantiation of template
class
'std::__1::is_nothrow_constructible<std::__1::allocator<std::__1::pair<const
char, C<char, int>::c> >, >' requested here
: public is_nothrow_constructible<_Tp>
^
/usr/include/c++/v1/map:730:13: note: in instantiation of template class
'std::__1::is_nothrow_default_constructible<std::__1::allocator<std::__1::pair<const
char, C<char, int>::c> > >' requested here
is_nothrow_default_constructible<allocator_type>::value &&
^
/usr/include/c++/v1/__config:288:34: note: expanded from macro '_NOEXCEPT_'
# define _NOEXCEPT_(x) noexcept(x)
^
1.cpp:4:8: note: in instantiation of exception specification for 'map'
requested here
struct C
^
1.cpp:6:10: note: definition of 'C<char, int>::c' is not complete until the
closing '}'
struct c;
^
1.cpp:20:16: note: implicit default constructor for 'C<char, int>' first
required here
C<char, int> cc;
^
1 error generated.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>