How to let C++ compiler raise a warning or error when a const is assigned to a const reference?
John (Eljay) Love-Jensen
eljay@adobe.com
Sun Sep 17 15:53:00 GMT 2006
Hi Peng,
Please do not cross-post to both gcc-help and gcc.
I believe your code is legal code.
It's not code that does what you want, but it is code that is doing what you told it to do.
Keep in mind, warnings are indicators that the compiler has discovered something suspect -- something that MAY BE an error and is something that people either do often enough (inadvertently) or is generally considered bad programming practice to warrant a warning (perhaps even being a recommended warning by ISO 14882).
My guess is, the situation you cited does not come up often in practice to have caused one of the GCC developers to put a warning into GCC.
HTH,
--Eljay
More information about the Gcc-help
mailing list