[clang] [clang]: support std::meta::info for primitive types (PR #190356)

Nhat Nguyen via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 15:24:24 PDT 2026


================
@@ -13102,7 +13102,10 @@ StmtResult TreeTransform<Derived>::TransformUnresolvedSYCLKernelCallStmt(
 template <typename Derived>
 ExprResult TreeTransform<Derived>::TransformCXXReflectExpr(CXXReflectExpr *E) {
   // TODO(reflection): Implement its transform
-  assert(false && "not implemented yet");
+  if (!E->isTypeDependent())
+    return E;
----------------
changkhothuychung wrote:

@Sirraide ah I see, thanks for the review! 

The reason I added this is because there was this suggested test from the last PR.

```cpp
template <typename T = X, auto ptm = &X::a>
constexpr auto ptmOp = ((T)(^^int)).*ptm;
```

This test should fail. As far as I understand, the template instantiator of clang will treat the expression `((T)(^^int)).*ptm` as being dependent, and will perform a semantic tree transformation on each element inside the expression. Currently, the tree transform of reflection is doing nothing, so the output doesn't output the correct error message as `can't perform a cast from std::meta::info to the destination type`. 

So maybe we should leave this unchanged for now and will consider addressing the test above later?

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


More information about the cfe-commits mailing list