[LLVMbugs] [Bug 17701] New: Compilation failure for std::map iterator member variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 26 11:44:15 PDT 2013


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

            Bug ID: 17701
           Summary: Compilation failure for std::map iterator member
                    variable
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zenju at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi,

I'm currently facing the following showstopper-bug. The very same code compiles
fine with GCC and VC:

#include <map>

struct Test
{
    std::map<int, Test>::iterator prev;
};

int main()
{
    return 0;
}


With clang 500.2.75 however I get this error message:

localhost:Obj zenju$ clang -std=c++11 -stdlib=libc++ test.cpp
In file included from test.cpp:1:
In file included from /usr/bin/../lib/c++/v1/map:371:
In file included from /usr/bin/../lib/c++/v1/__tree:16:
In file included from /usr/bin/../lib/c++/v1/memory:594:
/usr/bin/../lib/c++/v1/utility:221:9: error: field has incomplete type 'Test'
    _T2 second;
        ^
/usr/bin/../lib/c++/v1/__tree:602:16: note: in instantiation of template class
'std::__1::pair<int, Test>' requested here
    value_type __value_;
               ^
/usr/bin/../lib/c++/v1/__tree:624:22: note: in instantiation of template class
'std::__1::__tree_node<std::__1::pair<int, Test>, void *>'
      requested here
    typedef typename __node::base                                 __node_base;
                     ^
/usr/bin/../lib/c++/v1/map:541:19: note: in instantiation of template class
'std::__1::__tree_iterator<std::__1::pair<int, Test>,
      std::__1::__tree_node<std::__1::pair<int, Test>, void *> *, long>'
requested here
    _TreeIterator __i_;
                  ^
test.cpp:6:32: note: in instantiation of template class
'std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::pair<int, Test>,
      std::__1::__tree_node<std::__1::pair<int, Test>, void *> *, long> >'
requested here
        std::map<int, Test>::iterator prev;
                                      ^
test.cpp:4:8: note: definition of 'Test' is not complete until the closing '}'
struct Test
       ^
1 error generated.


I know that the iterator literally depends on the struct's type, however it
should not depend on the struct's size, so there is no reason to fail
compilation.


Regards, Zenju

-- 
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/20131026/dc0da201/attachment.html>


More information about the llvm-bugs mailing list