--- Comment #10 from c dot hite at rtsgroup dot net 2008-11-04 17:10
---
So you're saying this isn't a bug because G++ does what it does?
Is there no standard specifying what should happen? I would like to think if
two different compilers produce different results, one of them has a b
--- Comment #9 from rguenth at gcc dot gnu dot org 2008-11-04 15:15 ---
there are two name-lookup stages for unqualified ids, first regular unqualified
lookup which finds the local operator<< then argument-dependent lookup (Koenig
lookup) which finds operator<< in A.
--
rguenth at gc
--- Comment #8 from schwab at suse dot de 2008-11-04 14:21 ---
::operator<< is hidden by C::operator<< and cannot be found by name lookup.
A::operator<< is found because child is-a A::parent.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38005
--- Comment #7 from c dot hite at rtsgroup dot net 2008-11-04 13:36 ---
If it stopped at the first match, then the call in C would match the operator
in C and say the operands don't match and not compile. Instead C goes on to
call an operator defined in A.
Why does C check A and not th
--- Comment #6 from rguenth at gcc dot gnu dot org 2008-11-04 12:51 ---
You are wrong. Name-lookup _does_ stop at the first match. Name-lookup has
nothing to do with declaration matching - it only looks up names.
--
rguenth at gcc dot gnu dot org changed:
What|Remov
--- Comment #5 from c dot hite at rtsgroup dot net 2008-11-04 10:47 ---
I'm fine with case #1. I don't know if Sun is wrong, or there is no "right".
#2 is a BUG.
No, the lookup doesn't stop at "operator<<(Thing&o,Thing&)", it keeps going,
but it keeps going differently.
Please look a
--- Comment #4 from rguenth at gcc dot gnu dot org 2008-11-04 10:31 ---
namespace A {
class Parent{};
ostream& operator<<(ostream&o,const Parent&){return o<<"parent\n";}
}
namespace B {
class Child:public A::Parent{};
}
ostream& operator<<(ostream&o,const B::Child&){return
--- Comment #3 from c dot hite at rtsgroup dot net 2008-11-03 17:51 ---
The way in which the compiler finds operators has something is referred to as
"Koenig Lookup".
--
c dot hite at rtsgroup dot net changed:
What|Removed |Added
--
--- Comment #2 from c dot hite at rtsgroup dot net 2008-11-03 17:47 ---
Created an attachment (id=16621)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16621&action=view)
2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38005
--- Comment #1 from c dot hite at rtsgroup dot net 2008-11-03 17:47 ---
Created an attachment (id=16620)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16620&action=view)
1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38005
10 matches
Mail list logo