Module
이 같은 멤버 템플릿을 포함
In file included from /usr/local/Qt/linux-g++/include/QtCore/QLinkedList:2,
from /home/bamboo/Packages/Parser.h:17,
from /home/bamboo/Packages/Module.cpp:6:
/usr/local/Qt/linux-g++/include/QtCore/qlinkedlist.h: In member function 'void QLinkedList<T>::clear() [with T = int]':
/usr/local/Qt/linux-g++/include/QtCore/qlinkedlist.h:294: error: dereferencing pointer 'y' does break strict-aliasing rules
/usr/local/Qt/linux-g++/include/QtCore/qlinkedlist.h:293: note: initialized from here
/usr/local/Qt/linux-g++/include/QtCore/qlinkedlist.h:294: error: dereferencing pointer 'y' does break strict-aliasing rules
/usr/local/Qt/linux-g++/include/QtCore/qlinkedlist.h:293: note: initialized from here
: Parser<int>
및 클래스 파서 정의 :C++ 엄격한 앨리어싱 규칙과 오류를 컴파일 Qt를하고 QLinkedList
template <typename T> class Parser
{
// some stuff
QLinkedList<T> stuff;
};
및 코드 컴파일이 조각 멋지게 gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
로 그리고 멋지게 g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
로 그리고 g++ (Debian 4.4.5-8) 4.4.5
...와 나는 실패한다. 그리고 나는 전혀 모른다? 누구나이 오류 메시지를 보았고 누구든지 이것이 무엇을 의미 하는지를 알고 있습니까? 더 중요한 것은 그것을 해결하는 방법입니다.
가 additonally이 문서가 그것을 아주 잘 설명 않습니다 (당신을 완화 할 수 있습니다 경우에 따라서, 유명한 용 프로그램에 C 코드의 많은이
-fno-strict-aliasing
컴파일됩니다) : http://cellperformance.beyond3d.com/articles/2006 /06/understanding-strict-aliasing.html – dhein그래,이 질문을 게시하기 전에 해당 게시물을 보았습니다. Qt 헤더는 실제로이 기술을 사용하고 있습니다 ... 그래서 이것은 다른 것입니다. – fritzone
http://sscce.org를 만들면 다른 사람들이 그것을 컴파일하고 훑어 볼 수 있도록 더 나은 도움을받을 수 있습니다. 무슨 Qt 버전 btw? – Yakk