[clang] [clang] Implement the __builtin_type_order intrinsic for P2830R10 Constexpr Type Ordering (PR #216462)

Matthias Wippich via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 15 05:52:00 PDT 2026


================
@@ -2886,6 +2886,49 @@ class CXXPseudoDestructorExpr : public Expr {
   }
 };
 
+/// Represents a C++26 __builtin_type_order(T, U) expression. Used to implement
+/// std::type_order.
+class BuiltinTypeOrderExpr final : public Expr {
----------------
Tsche wrote:

Yeah, unfortunately the builtin trait infrastructure just allows us to return `bool` or `size_t`. I tried hacking it into TypeTraitExpr, but that was horrible. Ended up not reusing the type trait parsing either to make this a little less surprising/magic.

It's not the only builtin we handle this way. `__builtin_source_location` and `__builtin_bit_cast` are similar. 

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


More information about the cfe-commits mailing list