
Hi all, I found a probable bug in mingw. Here is the minimal code that can not compile: #include <boost/ptr_container/ptr_list.hpp>
#include <iostream>
class A { public: A(const int id):_id(id){} virtual ~A()=0; bool operator==(const A& other) const { return _id == other._id; } int _id; };
A::~A(){}
class B : public A { public: B(const int id):A(id){} virtual ~B() {} };
class C : public A { public: C(const int id):A(id){} virtual ~C() {} };
int main() { typedef boost::ptr_list<A> AList; AList a,b; a.push_back( new B(0) ); a.push_back( new C(1) ); b.push_back( new B(0) ); b.push_back( new C(1) );
return a == b; }
And the compilation error: gcc.compile.c++
T:\Analyse1\dist\lib\bin\gcc-mingw-4.3.0\debug\threading-multi\src\main.o c:\qt\mingw\bin\../lib/gcc/mingw32/4.3.0/include/c++/bits/boost_concept_check.h: In instantiation of '__gnu_cxx::_EqualOpConcept<A, A>': c:\qt\mingw\bin\../lib/gcc/mingw32/4.3.0/include/c++/bits/boost_concept_check.h:62: instantiated from 'void __gnu_cxx::__function_requires() [with _Concept = __gnu_cxx::_EqualOpCon cept<A, A>]' c:\qt\mingw\bin\../lib/gcc/mingw32/4.3.0/include/c++/bits/stl_algobase.h:943: instantiated from 'bool std::equal(_II1, _II1, _II2) [with _II1 = boost::void_ptr_iterator<std::_List_ const_iterator<void*>, const A>, _II2 = boost::void_ptr_iterator<std::_List_const_iterator<void*>, const A>]' T:\Analyse1\3rdParty\boost/boost/ptr_container/detail/reversible_ptr_container.hpp:531: instantiated from 'bool boost::ptr_container_detail::reversible_ptr_container<Config, CloneA llocator>::operator==(const boost::ptr_container_detail::reversible_ptr_container<Config, CloneAllocator>&) const [with Config = boost::ptr_container_detail::sequence_config<A, std:: list<void*, std::allocator<void*> > >, CloneAllocator = boost::heap_clone_allocator]' tests\src\main.cpp:38: instantiated from here c:\qt\mingw\bin\../lib/gcc/mingw32/4.3.0/include/c++/bits/boost_concept_check.h:296: error: cannot declare field '__gnu_cxx::_EqualOpConcept<A, A>::__a' to be of abstract type 'A' tests\src\main.cpp:6: note: because the following virtual functions are pure within 'A': tests\src\main.cpp:14: note: virtual A::~A() c:\qt\mingw\bin\../lib/gcc/mingw32/4.3.0/include/c++/bits/boost_concept_check.h:296: error: cannot declare field '__gnu_cxx::_EqualOpConcept<A, A>::__b' to be of abstract type 'A' tests\src\main.cpp:6: note: since type 'A' has pure virtual functions
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -mthreads -DBOOST_SYSTEM_DYN_LINK=1 -I"T:\Analyse1\3rdParty\boost" -I"tests\src" -c -o "T:\Analyse1\dist\lib\bin\gcc-mingw- 4.3.0\debug\threading-multi\src\main.o" "tests\src\main.cpp"
The problem might come from this: #define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \ template <class _Ret, class _First, class _Second> \ struct _NAME { \ void __constraints() { (void)__constraints_(); } \ _Ret __constraints_() { \ return __a _OP __b; \ } \ _First __a; \ _Second __b; \ } I hope it comes from me and not from boost... If anyone have an idea of what I can do to solve this, It would be great :) Regards, Eloi.