[PATCH] D146924: [clang] Add support for dollar sign in ud_suffix of numeric constants

Anna Arad via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 02:08:15 PDT 2023


annara added a comment.

After a second look at the standard, you are right.
It's not in the range of any of the universal-character-names.
That being said, it is allowed as an identifier by default in clang (as @tahonermann) mentioned.
It also works in current versions of clang if you use the UCN in the numeric constant (and leave the user-defined literal operator declaration with a $ sign).
As you stated, GCC also accepts this syntax.

I can make sure dollar signs not part of a ud-sufffix will be rejected, if you think the general idea is acceptable.

Regarding the difference between the dollar and the euro sign. It seems the lexer lexes the euro sign as part of the numeric constant (like any other ud_suffix) and probably fails at a later stage (I'm not sure where yet).
I suspect the dollar sign passes at that step because of `-fdollars-in-identifiers` being true by default.
But, I need to look into it further to give a real answer.

Please let me know if you think it's worth pursuing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146924/new/

https://reviews.llvm.org/D146924



More information about the cfe-commits mailing list