[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [g++-4.1] Strange problem with overloading
From: |
Armel Asselin |
Subject: |
Re: [g++-4.1] Strange problem with overloading |
Date: |
Tue, 13 Jun 2006 17:26:38 +0200 |
> I have a strange problem with recent g++ while trying to get a pointer
> on an overloaded function.
>
> To extract one specific version of the overloaded function I tried :
>
> float ( *v2d_cross )( const Vector2& , const Vector2& ) = cross;
>
> But then I get this error:
>
> src/wrappers/export_vertex.cpp|120| error: no matches converting
> function 'cross' to type 'float (*)(const class Vector2&, const class
> Vector2&)'
> src/utils/amap_util_vector.h|236| error: candidates are: float
> cross(const Vector2&, const Vector2&)
> src/utils/amap_util_vector.h|514| error: Vector3
> cross(const Vector3&, const Vector3&)
don't know if you could ever get that to work, but at least i'm sure it does
not work with most c++ compilers: there is no selection of a function
through a 'to-be-casted-to' rule, to use pointers to members/pointers to
function, you must have different names: you cannot 'overload'. Calling
directly disambiguates/works because you have tangible argument to
disambiguate. But casting does not give these arguments so the compiler
cannot choose.
Armel