jyknight wrote:
> It appears that gcc only disallows '$' in identifiers in C++26 mode. Not sure
> how relevant that is to clang.
> [bugzilla](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110343) Or am I
> misreading that thread?
As far as I can tell, GCC has _not_ disallowed '$' in identifiers at all (both
by testing and by inspection of that patch).
I'm not sure it really makes sense to do this change in Clang, either.
Firstly, it seems entirely unclear if the C++ proposal really _intended_ to
require this. The proposal explicitly noted that the change would break using a
_UCN_ for dollar-sign in an identifier -- which is pretty suggestive that the
authors did not expect it to forbid spelling the identifier with the actual
dollar-sign character in implementations supporting that extension ("For
extensions that allow, for example, $ in identifiers, no one outside of
compiler test suites, is likely to use a UCN to spell that.")
Also, I note that C was repaired to re-permit "$" as an implementation-defined
identifier character extension, via "It is implementation-defined if a $
(U+0024, DOLLAR SIGN) may be used as a nondigit character." from
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3145.pdf -- that document
seems to indicate that they felt the removal of the permission for this
implementation-extension was an unintended defect in the original change.
So, I wonder if this may be C++ defect? That C++ should be re-harmonized with
C, and permit implementations to allow $ as an identifier character. And, thus,
that we should await such a DR fix, and make no change to Clang's behavior.
https://github.com/llvm/llvm-project/pull/135407
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits