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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 07:57:38 PDT 2023


cor3ntin added a comment.

In D146924#4224237 <https://reviews.llvm.org/D146924#4224237>, @tahonermann wrote:

>> 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.
>
> 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. 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. Again, nothing to do here now; just something to be aware of.

I missed that comment @tahonermann 
The crash is there https://github.com/llvm/llvm-project/issues/62133
But fundamentally C and C++ having different behavior is nasty, so I wrote a paper https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3124.pdf


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