Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0 Beta 1, 5.0.0
-
None
-
OS X 10.7.4, Xcode 4.3.2, Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
-
19e2b4d6eb733d9fd4eb69c0622b699fd08a3203
Description
The following code failed when using clang and libc++ headers:
main.cpp
#include <QtCore> #include <algorithm> int main() { QList<int> lst; std::sort(lst.begin(), lst.end()); return 0; }
Project settings:
cxx11.pro
#------------------------------------------------- # # Project created by QtCreator 2012-05-03T10:02:33 # #------------------------------------------------- QT += core TARGET = cxx11 TEMPLATE = app macx-clang { QMAKE_CXXFLAGS += -stdlib=libc++ QMAKE_LFLAGS += -stdlib=libc++ } SOURCES += main.cpp
Error message:
16:56:02: Running steps for project cxx11... 16:56:02: Starting: "/usr/bin/make" clean -w make: Entering directory `/Users/stephenchu/Dropbox/cxx11' rm -f main.o rm -f *~ core *.core make: Leaving directory `/Users/stephenchu/Dropbox/cxx11' 16:56:02: The process "/usr/bin/make" exited normally. 16:56:02: Starting: "/Qt/5.0/qtbase/bin/qmake" /Users/stephenchu/Dropbox/cxx11/cxx11.pro -r -spec macx-clang CONFIG+=x86_64 16:56:02: The process "/Qt/5.0/qtbase/bin/qmake" exited normally. 16:56:02: Starting: "/usr/bin/make" -w make: Entering directory `/Users/stephenchu/Dropbox/cxx11' clang++ -c -pipe -mmacosx-version-min=10.5 -stdlib=libc++ -g -gdwarf-2 -Wall -W -fPIE -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/Qt/5.0/qtbase/mkspecs/macx-clang -I. -I/Qt/5.0/qtbase/include/QtCore -I/Qt/5.0/qtbase/include/QtGui -I/Qt/5.0/qtbase/include -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -I. -F/Qt/5.0/qtbase/lib -o main.o main.cpp In file included from main.cpp:1: In file included from /Qt/5.0/qtbase/include/QtCore/QtCore:4: In file included from /Qt/5.0/qtbase/include/QtCore/qabstractanimation.h:1: In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/animation/qabstractanimation.h:45: In file included from /Qt/5.0/qtbase/include/QtCore/qobject.h:1: In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:47: In file included from /Qt/5.0/qtbase/include/QtCore/qobjectdefs.h:1: In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45: In file included from /Qt/5.0/qtbase/include/QtCore/qnamespace.h:1: In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/global/qnamespace.h:45: In file included from /Qt/5.0/qtbase/include/QtCore/qglobal.h:1: In file included from /Qt/5.0/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:76: /usr/bin/../lib/c++/v1/algorithm:3646:90: error: no type named 'value_type' in 'std::__1::iterator_traits<QList<int>::iterator>' _VSTD::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ main.cpp:133:2: note: in instantiation of function template specialization 'std::__1::sort<QList<int>::iterator>' requested here std::sort(lst.begin(), lst.end()); ^ 1 error generated. make: *** [main.o] Error 1 make: Leaving directory `/Users/stephenchu/Dropbox/cxx11' 16:56:03: The process "/usr/bin/make" exited with code 2. Error while building/deploying project cxx11 (target: Desktop) When executing step 'Make'
This happens with or without std=c++11 option. Similar calls to std::sort are used in Qt 5 sources (qfilesystemmodel.cpp for example) and fail the same way when trying to build with libc++.