[clang] [clang]: implement std::meta::is_type (PR #211653)

Ambrose Leeb via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 08:59:22 PDT 2026


================
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fsyntax-only -verify
+// RUN: %clang_cc1 %s -std=c++26 -freflection -fexperimental-new-constant-interpreter -fsyntax-only -verify
+
+using info = decltype(^^int);
+
+struct S {};
+namespace A{};
+
+consteval void test_pass() {
+  static_assert(__builtin_meta_is_type(^^int));
----------------
Sirraide wrote:

I believe at least for _some_ of the tests, we can create a separate file with
```c++
#ifdef USE_BUILTIN
#  define meta_is_type(...) __builtin_meta_is_type(__VA_ARGS__)
#else
#  define meta_is_type(...) std::meta::is_type(__VA_ARGS__)
#endif
```
Some tests result in different diagnostics depending on whether we call the builtin directly or not, but at the very least all the `static_assert`s that pass could be merged into a single test like that

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


More information about the cfe-commits mailing list