Petr Mladek wrote:
[...]
I am fixing OOo to build with the upcoming gcc-4.1. And I got many similar
build errors like this one:
--- cut ---
/usr/src/packages/BUILD/ooo-build-2.1.137/build/src680-m137/cppuhelper/source/access_control.cxx:65:
instantiated from here
/usr/src/packages/BUILD/ooo-build-2.1.137/build/src680-m137/solver/680/unxlngi6.pro/inc/com/sun/star/uno/Any.hxx:240:
error: no matching function for call to
'getCppuType(com::sun::star::uno::Reference<com::sun::star::security::XAccessContr
oller>*)'
../unxlngi6.pro/inc/com/sun/star/uno/Exception.hpp:62: note: candidates are:
const com::sun::star::uno::Type& getCppuType(const
com::sun::star::uno::Exception*)
../unxlngi6.pro/inc/com/sun/star/uno/RuntimeException.hpp:44: note:
const com::sun::star::uno::Type& getCppuType(const
com::sun::star::uno::RuntimeException*)
../unxlngi6.pro/inc/com/sun/star/uno/TypeClass.hdl:57: note:
const com::sun::star::uno::Type& getCppuType(const
com::sun::star::uno::TypeClass*)
/usr/src/packages/BUILD/ooo-build-2.1.137/build/src680-m137/solver/680/unxlngi6.
--- cut ---
The problem is the following. Any.hxx defines some inline operators and
methods that use the function getCppuType. The function getCppuType is
declared for many types in the .hdl include files and is defined in the
related .hpp include files. Most of the .hpp files includes Any.hxx.
Thereafter, Any.hxx is usually included when the first .hpp file is included.
It means that Any.hxx is included before the other .hpp/.hdl files are
included. It means that the methods and operators from Any.hxx are defined
before the related getCppuType functions are even declared.
It worked in the past but gcc-4.1 does not longer allow this situation. I
discussed it with our gcc developers and they said that the code was broken.
The function getCppuType must be declared before it is used at least.
If I understand things correctly, the above problem boils down to
struct A {};
struct B {};
void f(A*);
template<typename T> void g(T t) { f(t); } // line 4
void f(B*);
void h(B*b) { g(b); } // line 6
being rejected by GCC 4.1, on the grounds that f(B*) is not visible at
the point of definition of template g.
After a quick look into Vandevoorde/Josuttis (which is often easier than
The Standard...), my understanding is that f in line 4 is an unqualified
dependent name (its argument type is dependent), and so two-phase lookup
happens for f, first in line 4 (seeing only f(A*)), and then in line 6
at the point of instantiation of g for B (seeing also f(B*)).
Petr, can you invite any of your GCC developers into our discussion? (I
won't be able to respond before Monday, however.)
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]