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

Daniel M. Katz via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 20:03:23 PDT 2026


================
@@ -6158,6 +6085,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
   if (getLangOpts().OpenCL && ASTTy->isSamplerT())
     return;
 
+  if (getLangOpts().Reflection && ASTTy->isMetaInfoType())
----------------
katzdm wrote:

I think it's not a matter of linkage, but a matter of odr-use outside of an immediate function context - variables of type `std::meta::info` shouldn't be usable in a manner that requires codegen, because of the rules sounds consteval-only types (note: not implemented here; in flux via CWG3150).

In the presence of consteval-only type rules, I think it would be better for this to be an assert - but I'm not sure we want an assert-failure crashing out every time somebody declared a non-constexpr `info`.

So maybe just let it leak to runtime for now and leave a `TODO`? What seems best for now?

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


More information about the cfe-commits mailing list