<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 --- - Compilation failure for std::map iterator member variable"
   href="http://llvm.org/bugs/show_bug.cgi?id=17701">17701</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compilation failure for std::map iterator member variable
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zenju@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</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>