https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11187
Martin Sebor changed:
What|Removed |Added
Last reconfirmed|2012-01-13 00:00:00 |2017-1-11
CC||msebor at gcc dot gnu.org
Known to fail||3.3, 4.5.3, 4.8.3, 4.9.3,
||5.3.0, 6.3.0, 7.0
--- Comment #3 from Martin Sebor ---
The signed case is still accepted by today's trunk. Clang diagnoses both as
expected.
$ (set -x && cat t.c && for s in signed unsigned; do gcc -DSIGN=$s -S -Wall
-xc++ t.c; done)
+ cat t.c
class Object
{
SIGN short value;
public:
operator SIGN short() { return value; }
operator SIGN int() { return value; }
};
SIGN int test(void)
{
Object a,b;
return a+b;
}
+ for s in signed unsigned
+ gcc -DSIGN=signed -S -Wall -xc++ t.c
+ for s in signed unsigned
+ gcc -DSIGN=unsigned -S -Wall -xc++ t.c
t.c: In function ‘unsigned int test()’:
t.c:12:10: error: ambiguous overload for ‘operator+’ (operand types are
‘Object’ and ‘Object’)
return a+b;
~^~
t.c:12:10: note: candidate: operator+(int, int)
t.c:12:10: note: candidate: operator+(int, unsigned int)
t.c:12:10: note: candidate: operator+(unsigned int, int)
t.c:12:10: note: candidate: operator+(unsigned int, unsigned int)