[clang] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 09:58:08 PDT 2025


================
@@ -1208,6 +1208,13 @@ Parser::ParseCastExpression(CastParseKind ParseKind, bool isAddressOfOperand,
     AllowSuffix = false;
     Res = ParseUnaryExprOrTypeTraitExpression();
     break;
+  case tok::caretcaret: {
+    if (getLangOpts().Reflection) {
----------------
cor3ntin wrote:

How do you distinguish a block though? Maybe we don;t want to do arbitrary lookahead to see if we find a brace everytime someone uses `^^`

I think for the time being I would prefer
  - `^^` is only lexed as one token in C++2c mode
  - It is always considered to be a splice

We can figure out recovery for objective c++ later (and maybe always propose a fixit to inject a space)

@AaronBallman @erichkeane 

https://github.com/llvm/llvm-project/pull/164692


More information about the cfe-commits mailing list