Issue 57855 - Bad uses of getCppuType (GCC 4.1)
Summary: Bad uses of getCppuType (GCC 4.1)
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: 680m139
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0.2
Assignee: b.osi.ooo
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-14 09:39 UTC by Stephan Bergmann
Modified: 2006-01-18 11:11 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stephan Bergmann 2005-11-14 09:39:35 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.
Comment 1 Stephan Bergmann 2005-11-14 09:40:28 UTC
.
Comment 2 Stephan Bergmann 2006-01-02 10:34:22 UTC
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.
Comment 3 Stephan Bergmann 2006-01-03 08:14:53 UTC
.
Comment 4 Stephan Bergmann 2006-01-03 09:48:46 UTC
.

re-open issue and reassign to tbo@openoffice.org
Comment 5 Stephan Bergmann 2006-01-03 09:49:14 UTC
reassign to tbo@openoffice.org
Comment 6 Stephan Bergmann 2006-01-03 09:49:21 UTC
reset resolution to FIXED
Comment 7 b.osi.ooo 2006-01-05 14:47:07 UTC
 verified 
Comment 8 quetschke 2006-01-08 03:37:22 UTC
Sorry to reopen, but sb41 fails in my tinderbox with:
<http://go-oo.org/tinderbox/gunzip.cgi?tree=sb41&brief-log=1136657080.26426#EOF>
Comment 9 quetschke 2006-01-08 03:57:19 UTC
Sorry, cmcfixes22 has the same problem. See issue 60180.
Comment 10 quetschke 2006-01-08 03:57:41 UTC
Back to verified.
Comment 11 davidfraser 2006-01-10 12:56:53 UTC
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?
Comment 12 Stephan Bergmann 2006-01-10 13:16:33 UTC
@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?
Comment 13 Stephan Bergmann 2006-01-11 09:39:55 UTC
@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.)
Comment 14 davidfraser 2006-01-12 07:16:05 UTC
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
Comment 15 Stephan Bergmann 2006-01-12 08:44:05 UTC
@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.)
Comment 16 b.osi.ooo 2006-01-16 18:54:13 UTC
 close 
Comment 17 Stephan Bergmann 2006-01-17 13:17:11 UTC
See issues 60691, issue 60700, and issue 60701 for documentation issues related
to this issue.
Comment 18 davidfraser 2006-01-18 11:11:56 UTC
OK thanks for the info sb, and sorry for the confusion