[LLVMbugs] [Bug 13471] New: STL and incomplete types problem with libc++, works without libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 26 19:32:54 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13471

             Bug #: 13471
           Summary: STL and incomplete types problem with libc++, works
                    without libc++
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: nickwalters99 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This is a small example which I have isolated from some larger code of
something which I am normally able to compile with C++ and even C++ 11 but when
I compile with -stdlib=libc++ it fails. I am running Mountain Lion and the
clang++ from Xcode 4.4.

#include <list>

using namespace std;

class Foo;

typedef list<Foo> FooList;

class Foo{
public:
  int a;

  FooList fooList;
};

int main(int argc, char** argv){
  return 0;
}

clang++ test.cpp -o test # works fine
clang++ -std=c++11 test.cpp -o test # also works fine

clang++ -std=c++11 -stdlib=libc++ test.cpp -o test # fails with:

In file included from test.cpp:1:
/usr/bin/../lib/c++/v1/list:212:9: error: field has incomplete type 'Foo'
    _Tp __value_;
        ^
/usr/bin/../lib/c++/v1/type_traits:1889:54: note: in instantiation of template
      class 'std::__1::__list_node<Foo, void *>' requested here
decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type())
                                                     ^
/usr/bin/../lib/c++/v1/type_traits:1890:1: note: while substituting deduced
      template arguments into function template '__is_constructible_test' [with
      _Tp = std::__1::allocator<std::__1::__list_node<Foo, void *>>, _Args =
<no
      value>]
__is_constructible_test(_Tp&&, _Args&& ...);
^
/usr/bin/../lib/c++/v1/type_traits:1949:14: note: in instantiation of template
      class 'std::__1::__is_constructible<false,
      std::__1::allocator<std::__1::__list_node<Foo, void *>>,
      std::__1::allocator<std::__1::__list_node<Foo, void *>> &&>' requested
      here
    : public __is_constructible<is_scalar<_Tp>::value || ...
             ^
/usr/bin/../lib/c++/v1/type_traits:1975:14: note: in instantiation of template
      class 'std::__1::__is_constructible_void_check<false,
      std::__1::allocator<std::__1::__list_node<Foo, void *>>,
      std::__1::allocator<std::__1::__list_node<Foo, void *>> &&>' requested
      here
    : public __is_constructible_void_check<__contains_void<_Tp,
_Args...>::value
             ^
/usr/bin/../lib/c++/v1/type_traits:2455:34: note: in instantiation of template
      class
     
'std::__1::is_constructible<std::__1::allocator<std::__1::__list_node<Foo,
      void *>>, std::__1::allocator<std::__1::__list_node<Foo, void *>> &&>'
      requested here
    : __is_nothrow_constructible<is_constructible<_Tp, ...
                                 ^
/usr/bin/../lib/c++/v1/type_traits:2590:14: note: (skipping 1 context in
      backtrace; use -ftemplate-backtrace-limit=0 to see all)
    : public is_nothrow_constructible<_Tp, typename ...
             ^
/usr/bin/../lib/c++/v1/memory:2219:20: note: in instantiation of template class
     
'std::__1::is_nothrow_move_constructible<std::__1::allocator<std::__1::__list_node<Foo,
      void *>>>' requested here
                   is_nothrow_move_constructible<_T2>::value)
                   ^
/usr/bin/../lib/c++/v1/__config:253:34: note: expanded from macro '_NOEXCEPT_'
#  define _NOEXCEPT_(x) noexcept(x)
                                 ^
/usr/bin/../lib/c++/v1/memory:2386:15: note: in instantiation of template class
      'std::__1::__libcpp_compressed_pair_imp<unsigned long,
      std::__1::allocator<std::__1::__list_node<Foo, void *>>, 2>' requested
      here
    : private __libcpp_compressed_pair_imp<_T1, _T2>
              ^
/usr/bin/../lib/c++/v1/list:513:52: note: in instantiation of template class
      'std::__1::__compressed_pair<unsigned long,
      std::__1::allocator<std::__1::__list_node<Foo, void *>>>' requested here
    __compressed_pair<size_type, __node_allocator> __size_alloc_;
                                                   ^
/usr/bin/../lib/c++/v1/list:770:15: note: in instantiation of template class
      'std::__1::__list_imp<Foo, std::__1::allocator<Foo>>' requested here
    : private __list_imp<_Tp, _Alloc>
              ^
test.cpp:13:11: note: in instantiation of template class 'std::__1::list<Foo,
      std::__1::allocator<Foo>>' requested here
  FooList fooList;
          ^
test.cpp:9:7: note: definition of 'Foo' is not complete until the closing '}'
class Foo{
      ^
1 error generated.

Thanks!

Nick

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list