confusion about string.erase( --string.end() )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

afaics the gcc-4.6 accepts following code:

#include <string>
int main()
{
        std::string line( "blabla" );
        line.erase( --line.end() );
}

but other compilers reject such code:

msvc8  : error C2105: '--' needs l-value
comeau : error: expression must be a modifiable lvalue

is it a bug in g++?

BR,
Paweł.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux