[LLVMbugs] [Bug 16801] New: std::pair: incomplete type error in template class instantiation.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 5 18:10:40 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=16801
Bug ID: 16801
Summary: std::pair: incomplete type error in template class
instantiation.
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: hhinnant at apple.com
Reporter: igor.solovyov at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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 Bug #13471.
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130806/cd380e55/attachment.html>
More information about the llvm-bugs
mailing list