[Bug c++/50306] ambiguous templated conversion operators accepted

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 17 19:05:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50306

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-11-17 18:27:00 UTC ---
(In reply to comment #1)
> I have never worked with the GCC source code before, any pointers to where I
> should start to look to fix this issue? Thanks!

http://gcc.gnu.org/wiki/DebuggingGCC

You could put a breakpoint for the second testcase in error(). Find out why the
error triggers, and then find out what is the difference with the first
testcase. In any case, the relevant code is in gcc/cp/. I hope you don't get
scared by the looks. It ain't pretty.

However, this seems to be fixed in trunk (at least revision 180166):

manuel@gcc12:~$ ~/trunk/180166/build/gcc/cc1plus pr50306.cc
 void func(SmartPtr<A>) int main()
pr50306.cc:15:9: error: conversion from ‘SmartPtr<B>’ to ‘SmartPtr<A>’ is
ambiguous
pr50306.cc:14:15: note: candidates are:
pr50306.cc:7:3: note: SmartPtr<T>::operator SmartPtr<A>() const [with T = B]
pr50306.cc:6:3: note: SmartPtr<T>::operator const SmartPtr<A>&() const [with T
= B]
pr50306.cc:10:6: error:   initializing argument 1 of ‘void func(SmartPtr<A>)’

Maybe you should try 4.6.2?



More information about the Gcc-bugs mailing list