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

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 07:28:40 PDT 2023


tahonermann added a comment.

> It's not in the range of any of the universal-character-names.

I assume you mean that it isn't included in the range of UCNs that are allowed in identifiers. If so, that is correct; it is neither in XID_Start <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B:XID_Start=Yes:%5D> or XID_Continue <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B:XID_Continue=Yes:%5D> (note that the current wording for the C and C++ standards was recently changed for C23 and C++23 to defer to the Unicode standard for what characters are allowed in identifiers; see N2836 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2836.pdf> and P1949 <https://wg21.link/p1949>).

Interesting, Clang currently crashes when `$` is specified using a UCN in an identifier with `-fno-dollars-in-identifiers`. It would be nice to correct that issue with this patch. See https://godbolt.org/z/9c7Pc8jbT. Nothing to do here now; just something to be aware of.

There is also a proposal to WG14 to allow `$` in identifiers. See N3046 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3046.pdf>. I don't think that paper has been reviewed by WG14 yet. If approved by WG14, I would expect a similar proposal to be submitted to WG21. Again, nothing to do here now; just something to be aware of.

There is a proposal to WG21 to add `$` (and other characters) to the basic character set. See P2558 <https://wg21.link/p2558>. If accepted as currently proposed, it would make use of a UCN to name `$` outside of character and string literals ill-formed.


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