forwarded from http://bugs.debian.org/198042] attached preprocessed source compiles with gcc-3.2.3, fails with 3.3 CVS 20030626 Daniel Stone writes: I'm trying to build aspseek[1] with gcc3.3, and failing. The problem is this: class CPtr<T> { doRelease() { p->Release(); } } class CStackElem { public: void Release() { ... } } class CSearchExpression : public CStackElem; The p in CPtr's doRelease is the template given. Now, when running with CPtr<CSearchExpression> (or CPtr<CWord1> - they're both in the same boat), Release is allegedly 'undeclared in this context'. It's not declared up in CSearchExpression (causing a conflict), it's just undeclared, apparently. In the sources I have, CPtr::doRelease() is actually CPtr::Release(), but changing it to doRelease() doesn't help. CPtr does have some extremely funky operator overloads tho (->, *, etc), so maybe that's what's causing it. I tried to compress this down to a small testcase, but unfortunately failed. Myself and Matt Zimmerman tried numerous methods of squashing this, including declaring Release() explicitly in CSearchExpression, and more, but failed. This appears to be a regression, as it builds fine with gcc3.2, and I can't see how it could be undeclared. $ g++ -O2 -c qparser.ii In file included from qparser.cpp:24: ../include/ccom.h: In destructor `CPtr<T>::~CPtr() [with T = CSearchExpression] ': /usr/include/c++/3.2/bits/stl_construct.h:125: instantiated from `void std::_Destroy(_Tp*) [with _Tp = std::pair<const CUWord, CPtr<CSearchExpression> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:542: instantiated from `void __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_delete_node(__gnu_cxx::_Hashtable_node<_Val>*) [with _Val = std::pair<const CUWord, CPtr<CSearchExpression> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CSearchExpression> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CSearchExpression> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:953: instantiated from `void __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::clear() [with _Val = std::pair<const CUWord, CPtr<CSearchExpression> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CSearchExpression> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CSearchExpression> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:326: instantiated from `__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::~hashtable() [with _Val = std::pair<const CUWord, CPtr<CSearchExpression> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CSearchExpression> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CSearchExpression> >]' ../include/qparser.h:94: instantiated from here ../include/ccom.h:74: error: `Release' undeclared (first use this function) ../include/ccom.h:74: error: (Each undeclared identifier is reported only once for each function it appears in.) ../include/ccom.h: In destructor `CPtr<T>::~CPtr() [with T = CWord1]': /usr/include/c++/3.2/bits/stl_construct.h:125: instantiated from `void std::_Destroy(_Tp*) [with _Tp = std::pair<const CUWord, CPtr<CWord1> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:542: instantiated from `void __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_delete_node(__gnu_cxx::_Hashtable_node<_Val>*) [with _Val = std::pair<const CUWord, CPtr<CWord1> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CWord1> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CWord1> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:953: instantiated from `void __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::clear() [with _Val = std::pair<const CUWord, CPtr<CWord1> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CWord1> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CWord1> >]' /usr/include/c++/3.2/ext/stl_hashtable.h:326: instantiated from `__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::~hashtable() [with _Val = std::pair<const CUWord, CPtr<CWord1> >, _Key = CUWord, _HashFcn = __gnu_cxx::hash<CUWord>, _ExtractKey = std::_Select1st<std::pair<const CUWord, CPtr<CWord1> > >, _EqualKey = std::equal_to<CUWord>, _Alloc = std::allocator<CPtr<CWord1> >]' ../include/qparser.h:94: instantiated from here ../include/ccom.h:74: error: `Release' undeclared (first use this function)
Created attachment 4353 [details] preprocessed source
This is a known deficiency in the old parser that is already fixed with the new parser to be part of gcc3.4. The work around for now is to write p->template Release (); Not nice, but works. W.