[LLVMbugs] [Bug 13925] Qt's QList iterators and std::distance.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 26 12:13:04 PDT 2012


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

Howard Hinnant <hhinnant at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #7 from Howard Hinnant <hhinnant at apple.com> 2012-09-26 14:13:04 CDT ---
Thanks for the preprocess.

This is a Qt bug, just not the one I thought it was.  Qt is forward declaring:

    struct random_access_iterator_tag;

in qt4/QtCore/qiterator.h.

 This is hiding the actual std::random_access_iterator_tag.  In the subsequent
definition of std::iterator_traits, libc++ looks for
std::random_access_iterator_tag, finds the fake forward-declared one, and notes
that it is not implicitly convertible to std::input_iterator_tag.  libc++ then
decides QList<char>::iterator doesn't meet the iterator requirements of section
24.2 in the standard because its iterator_category is not convertible to
std::input_iterator_tag.

Section 17.6.2.2 paragraph 3 says that a program must #include the correct
respective header before referencing any entity of that header:  a forward
declaration is not sufficient.  As more implementations start to use inline
namespaces to version their ABI, forward declaring std components such as this
will cause more and more problems like this one.

You can fix Qt by replacing the forward declarations with #include <iterator>
in qt4/QtCore/qiterator.h.

-- 
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