http://llvm.org/bugs/show_bug.cgi?id=22772
Bug ID: 22772
Summary: Inheriting from two classes with increment operators
Product: new-bugs
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
This program does not compile
class A
{
public:
A& operator++(){return *this;}
};
class B
{
public:
B operator++(int){return *this;}
};
class C:public A, public B
{
};
int main()
{
C c;
c.C::operator++(0);
c.C::operator++();
}
Output:
20 : error: member 'operator++' found in multiple base classes of different
types
c.C::operator++(0);
^
4 : note: member found by ambiguous name lookup
A& operator++(){return *this;}
^
10 : note: member found by ambiguous name lookup
B operator++(int){return *this;}
^
21 : error: member 'operator++' found in multiple base classes of different
types
c.C::operator++();
^
4 : note: member found by ambiguous name lookup
A& operator++(){return *this;}
^
10 : note: member found by ambiguous name lookup
B operator++(int){return *this;}
^
But if I write c++ or ++c instead of explicit calls, it does. It seems like the
first responce is correct, because name lookup should be performed first,
without considering the argument list. GCC, for example, rejects the code in
both cases.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs