I know it works with const.
Then how is it compiling in windows.Why I am not getting compile error on windows ?
Is this related to some compile time options
.\test.cpp(9) : warning C4239: nonstandard extension used : 'argument' : conversion from 'std::basic_string<_Elem,_Traits,_Ax>' to 'std::string &'
with
[
_Elem=char,
_Traits=std::char_traits,
_Ax=std::allocator
]
A non-const reference may only be bound to an lvalue
Linking...
One reason why I compile with maximum warnings and treat warnings as errors.