[Bug c++/24011] ambiguous overload reported for no obvious reason
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Sep 22 15:18:00 GMT 2005
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-22 15:17 -------
the error message about ambiguous overload is correct as there are two functions there.
operator* in the global namespace and operator* in the NS namespace.
You most likely wanted to implement operator* in the NS namespace and not a new one in the global
namespace.
The following code does what you wanted to do:
// Barebones code to reproduce the problem:
// Interface
namespace NS
{
template<typename T> class X {};
template<typename T> X<T> operator*(const X<T> &a, const X<T> &b);
}
// Implementation
template<typename T>
NS::X<T>NS::operator*(const NS::X<T> &a,const NS::X<T> &b)
{
return NS::X<T>();
}
// Application
int main(int argc, char *argv[])
{
NS::X<int> tmp = NS::X<int>() * NS::X<int>();
}
Notice how I wrote the Implementation.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24011
More information about the Gcc-bugs
mailing list