Re: strange looking ambiguity with type cast
Re: strange looking ambiguity with type cast
- Subject: Re: strange looking ambiguity with type cast
- From: Shawn Erickson <email@hidden>
- Date: Wed, 11 Feb 2004 14:40:58 -0800
On Feb 11, 2004, at 1:35 PM, GoochRules! wrote:
On Feb 11, 2004, at 2:17 PM, jean-frangois gauthier wrote:
maybe i'm simply missing something, here. why is gcc trying to use
a's constructor in the first place? aren't (a) _b and _b. operator a
() strictly equivalent? is it possible that gcc might be confusing a
(_b) and (a) _b?
jean-frangois
I think what you're missing is that there's a unnamed temporary of
type a created during (a) _b, because operator a() returns an a& by
definition.
So, gcc isn't confusing a::a(b) with b::operator a(), it simply need
to know whether to call b::operator a() or b::operator int() to pass
to the appropriate constructor for a.
Wow now I know why I generally don't like using operator overloading or
C++ in general for that matter... ;-)
-Shawn
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.