[clang] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 23 09:54:41 PDT 2025
================
@@ -1848,6 +1848,11 @@ def err_placeholder_expected_auto_or_decltype_auto : Error<
"expected 'auto' or 'decltype(auto)' after concept name">;
}
+let CategoryName = "Reflection Issue" in {
+def err_cannot_reflect_operand : Error<
+ "cannot reflect the provided operand">;
----------------
Sirraide wrote:
The problem w/ that is that in order to print it properly, we’d have to know what it is... which would require parsing it, but we only issue that error if we *can’t* parse it. So really, there isn’t anything you can do here beyond just printing the token, which isn’t really helpful.
The wording of this diagnostic is also not that great imo: ‘cannot reflect the provided operand’ makes sense if someone writes e.g. `^^4` because we just don’t support that yet, but if we encounter e.g. `^^]`, then that message doesn’t really makes sense because `]` isn’t really an ‘operand’, it’s just a syntax error.
I don’t really have a good idea as to how to phrase this, because e.g. ‘expected namespace or type’ might be fine for now, but if this eventually turns into ‘expected namespace or type or attribute or expression’ or something of the sort then that’s a pretty terrible diagnostic.
Maybe ‘expected reflectable entity’ or something of that sort? I don’t quite remember if the standard has a term that refers to ‘anything that can be a reflexion’.
https://github.com/llvm/llvm-project/pull/164692
More information about the cfe-commits
mailing list