As far as the standard is concerned, you can only use members of the basic source character set in the string literals (and elsewhere in the program). How the physical representation of the program is mapped to the basic source character set is implementation-defined.
g++ apparently thinks that ASCII \x0A
, ASCII \x0D
, and ASCII \x0D\x0A
are all valid representations of the member of the basic source character set called "newline". Which is totally reasonable, given that it is desirable for source code transferred between Windows, Unix and Mac OS X Classic machines to keep its meaning.