Posted on 1997-06-02
warning C4270: 'initializing' : do not initialize a non-const 'class ::String __near &' with a non-lvalue 'class ::String ' function return
This is my first test question.
I would like to know if this is a legitimate warning of if it is a bug in the compiler(MS C++ 1.52).
in book Teach Yourself C++ in 21 days ( Perry)
there is a reference that it is a bug.
(sorry i dont know the page)
here is the statement that gives the warning.
*m_pName = setName(); : warning C4270 etc.
the relevant declarations are
String * m_pName;
the definition is
looking at the statement
*m_pName = setName();
The String pointed to by *m_pName calls it's operator= and copies in the contents of the String in setName(). This is precisely what I want it to do and cannot see why the compiler has any justification for complaining.