[clang] [clang-tools-extra] [llvm] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)
Daniel M. Katz via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 28 18:15:10 PDT 2025
================
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fsyntax-only -verify
+
+namespace a {
+struct X {
+ int y;
+ bool operator==(const X& other)
+ {
+ return y == other.y;
+ }
+};
+
+namespace b {
+ struct Y {};
+ int x;
+}
+
+template<typename T>
+struct Z{
+ template<typename U>
+ using type = U;
+};
+
+}
+
+int main()
+{
+ (void)(^^::);
+ (void)(^^void);
+ (void)(^^bool);
+ (void)(^^char);
+ (void)(^^signed char);
+ (void)(^^unsigned char);
+ (void)(^^short);
+ (void)(^^unsigned short);
+ (void)(^^int);
+ (void)(^^unsigned int);
+ (void)(^^long);
+ (void)(^^unsigned long);
+ (void)(^^long long);
+ (void)(^^float);
+ (void)(^^double);
+
+ // Not supported yet.
+ (void)^^a; // expected-error {{expected reflectable entity}}
+ (void)^^a::; // expected-error {{expected reflectable entity}}
----------------
katzdm wrote:
There might be room for a better diagnostic for this case, but I personally think it's fine for now, and we can always work on improving it later.
@erichkeane @cor3ntin Wdyt?
https://github.com/llvm/llvm-project/pull/164692
More information about the llvm-commits
mailing list