operator+ and void*: differences between g++ and msvc

Hi, I am trying to perform an exhaustive testing of the operator traits. I came to the following issue: this code yields an error with msvc and only a warning with g++: int lhs=0; void* rhs=0; lhs + rhs; * msvc (Visual C++ 2010 Express): error C2036: 'void *' : unknown size warning C4552: '+' : operator has no effect; expected operator with side-effect * g++ (4.5.3): warning: pointer of type 'void *' used in arithmetic The standard says: "Either both operands shall have arithmetic or enumeration type, or one operand shall be a pointer to a completely defined object type and the other shall have integral or enumeration type." So it seems to me that an error should be issued by g++. What is your understanding of the standard? If this is so, do you suggest me to file a bug to g++? Frédéric

2011/6/16 Frédéric Bron <frederic.bron@m4x.org>
So it seems to me that an error should be issued by g++. What is your understanding of the standard? If this is so, do you suggest me to file a bug to g++?
It's not standard, but it is an intentional extension. They do no consider it a bug. -- -Matt Calabrese

On 17/06/2011 06:49, Frédéric Bron wrote:
It's not standard, but it is an intentional extension. They do no consider it a bug.
But I compile with -std=c++98 or c++0x (not -std=gnu++98 or gnu++0x).
I suppose using -pedantic-errors would do what you want. Anyway, what does this have to do with Boost development?
participants (3)
-
Frédéric Bron
-
Mathias Gaunard
-
Matt Calabrese