Apache OpenOffice (AOO) Bugzilla – Issue 57855
Bad uses of getCppuType (GCC 4.1)
Last modified: 2006-01-18 11:11:56 UTC
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/XComponentContext.hpp" int main() { com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > c; com::sun::star:.uno::Any a; a <<= c; } does not compile with GCC 4.1: The template Any::operator<<=() defined in Any.hxx uses getCppuType from the global namespace before the overload getCppuType(Reference<XComponentContext>const*) from XComponentContext.hpp is seen, so that overload is not available when Any::operator<<=() is instantiated for Reference<XComponentContext>. A solution might be to use the template getCppuType<T>() instead in the template Any::operator<<=(). However, getCppuType<T>() has slightly different semantics than getCppuType(T const*), see the comment in cppu/inc/com/sun/star/uno/Type.h 1.13, lines 403ff.
.
Fixed by deprecating getCppuType and offering new cppu::UnoType and cppu::getTypeFavourUnsigned instead (and changing problematic uses of getCppuType to use the new functionality). Tests in cppu/qa/test_unotype.cxx.
. re-open issue and reassign to tbo@openoffice.org
reassign to tbo@openoffice.org
reset resolution to FIXED
verified
Sorry to reopen, but sb41 fails in my tinderbox with: <http://go-oo.org/tinderbox/gunzip.cgi?tree=sb41&brief-log=1136657080.26426#EOF>
Sorry, cmcfixes22 has the same problem. See issue 60180.
Back to verified.
sb41 Fails on my Windows build (using Visual Studio) in cppuhelper when building source/component.cxx: error C2665: 'cppu::detail::cppu_getUnoType' : none of the 18 overloads can convert parameter 1 from type 'com::sun::star::lang::EventObject *' Removing the cws causes the build to succeed. Has this been tested on Windows?
@davidfraser: What compiler version are you using? I managed to build with "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86." And source/component.cxx in which module has the problem, and in which line?
@davidfraser: Another explanation could be that the changes for this fix introduced a build incompatibility, and you are trying to do a compatible build. (All the UNO C++ headers generated by cppumaker are affected and need to be rebuild, in module offuh as well as where cppumaker is used locally within other modules.)
sb: mine is Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 which sounds the same as yours... module is cppuhelper, full error log below. The line number given for the error is actually in unotype.hxx line 283, there doesn't seem to be an indication of what causes the error in cppuhelper/source/component.cxx guw.pl /cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/bin/cl.exe -Zm500 -wd4251 -wd4275 -wd4290 -wd4786 -wd4800 -Zc:forScope -GR -c -nologo -Gs -Gy -I. -I../wntmsci10.pro/inc -I../wntmsci10.pro/inc/private -I../inc -I../inc -I../WIN/inc -I../wntmsci10.pro/inc -I. -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solver/680/wntmsci10.pro/inc/stl -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solver/680/wntmsci10.pro/inc/external -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solver/680/wntmsci10.pro/inc -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solenv/wntmsci10/inc -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solenv/inc -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/res -I/cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/solver/680/wntmsci10.pro/inc/stl -I/cygdrive/c/java/J2SDK1~1.2_0/include/win32 -I/cygdrive/c/java/J2SDK1~1.2_0/include -I/cygdrive/c/DevTools/MICROS~2/include -I/cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/include -I. -I../res -I. -Ob1 -Oxs -Oy- -Gd -GX -DWNT -DWNT -DNT351 -DMSC -DM1310 -DINTEL -D_USE_NAMESPACE -D_X86_=1 -DFULL_DESK -DSTLPORT_VERSION=400 -DWINVER=0x400 -D_WIN32_IE=0x400 -D_MT -DCPPU_ENV=msci -DSUPD=680 -DPRODUCT -DNDEBUG -DPRODUCT_FULL -DOSL_DEBUG_LEVEL=0 -DOPTIMIZE -DEXCEPTIONS_ON -DCUI -DSOLAR_JAVA -DOOA680 -DSHAREDLIB -D_DLL_ -DWIN32 -D_MT -D_DLL -DWIN32 -D_MT -D_DLL -DMULTITHREAD -W3 -Fo../wntmsci10.pro/slo/component.obj /cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/cppuhelper/source/component.cxx guw.pl /cygdrive/c/PROGRA~1/MICROS~1.NET/Vc7/bin/cl.exe @/tmp/mkHWkOC1 component.cxx e:\ooo-build\win-build-ooo201\build\ooa680-m1\cppuhelper\source\component.cxx(112) : warning C4101: 'exc' : unreferenced local variable e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(283) : warning C4675: 'const com::sun::star::uno::Type &com::sun::star::uno::cppu_getUnoType(const com::sun::star::uno::RuntimeException *)' : resolved overload was found by argument-dependent lookup ..\wntmsci10.pro\inc\com\sun\star\uno\RuntimeException.hpp(49) : see declaration of 'com::sun::star::uno::cppu_getUnoType' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(281) : while compiling class-template member function 'const com::sun::star::uno::Type &cppu::UnoType<T>::get(void)' with [ T=com::sun::star::uno::RuntimeException ] ..\wntmsci10.pro\inc\com\sun\star\uno\RuntimeException.hpp(61) : see reference to class template instantiation 'cppu::UnoType<T>' being compiled with [ T=com::sun::star::uno::RuntimeException ] e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(283) : error C2665: 'cppu::detail::cppu_getUnoType' : none of the 18 overloads can convert parameter 1 from type 'com::sun::star::lang::EventObject *' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(131): could be 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const cppu::UnoVoidType *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(136): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const bool *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(141): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_Bool *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(146): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_Int8 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(151): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_Int16 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(156): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const cppu::UnoUnsignedShortType *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(162): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_Int32 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(167): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_uInt32 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(173): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_Int64 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(178): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const sal_uInt64 *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(184): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const float *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(189): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const double *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(194): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const cppu::UnoCharType *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(199): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const rtl::OUString *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(204): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const com::sun::star::uno::Type *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(209): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const com::sun::star::uno::Any *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(230): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const com::sun::star::uno::Exception *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(235): or 'const com::sun::star::uno::Type &cppu::detail::cppu_getUnoType(const com::sun::star::uno::XInterface *)' while trying to match the argument list '(com::sun::star::lang::EventObject *)' e:\ooo-build\win-build-ooo201\build\ooa680-m1\solver\680\wntmsci10.pro\inc\cppu\unotype.hxx(281) : while compiling class-template member function 'const com::sun::star::uno::Type &cppu::UnoType<T>::get(void)' with [ T=com::sun::star::lang::EventObject ] ..\wntmsci10.pro\inc\com\sun\star\lang\EventObject.hpp(64) : see reference to class template instantiation 'cppu::UnoType<T>' being compiled with [ T=com::sun::star::lang::EventObject ] dmake: Error code 2, while making '../wntmsci10.pro/slo/component.obj' ---* tg_merge.mk *--- ERROR: Error 65280 occurred while making /cygdrive/e/ooo-build/win-build-ooo201/build/ooa680-m1/cppuhelper/source
@davidfraser: You are obviously building with old files; your error log suggests that you are using revision 1.1.2.1 (instead of 1.1.2.2) of cppu/inc/cppu/unotype.hxx. (This issue is now integrated in SRC680m150, which should be ready soon, so you might want to build that branch instead.)
close
See issues 60691, issue 60700, and issue 60701 for documentation issues related to this issue.
OK thanks for the info sb, and sorry for the confusion