Implementing p0515 - spaceship operator
Joseph Myers
joseph@codesourcery.com
Thu Jan 11 14:06:00 GMT 2018
On Thu, 11 Jan 2018, David Brown wrote:
> Maybe it is easier to say "gcc supports <=> in C++2a, and as an
> extension also supports it in C and C++ of any standard" ? I don't
> believe there is any way for it to conflict with existing valid code, so
> it would do no harm as a gcc extension like that - and C users can then
> use it too.
As per previous IRC discussion, changing the lexing to support this
pp-token can break valid code in previous standards, e.g. code
concatenating <=> and >, then stringizing the result (the C++ proposal for
adding this feature also notes some obscure cases where the character
sequence <=> can actually occur as tokens, not just pp-tokens -
"X<&Y::operator<=>" and "x+&operator<=>y" - so of course patches adding
this feature should add testcases using such cases with older -std=
options).
Changes to cpp_avoid_paste (so that preprocessed output does not put a
pp-token starting with > immediately after <=) do not need to be
conditional on the standard version, however.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list