[libcxx-commits] [clang] [libcxx] [Clang] Add __common_type builtin (PR #99473)

Aaron Ballman via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 19 07:54:58 PDT 2024


================
@@ -0,0 +1,184 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++17 %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=c++20 %s
+
+#if !__has_builtin(__builtin_common_type)
+#  error
+#endif
+
+// expected-note@*:* {{template declaration from hidden source: template <template <class ...> class, template <class> class, class, class ...>}}
+
+void test() {
+  __builtin_common_type<> a; // expected-error {{too few template arguments for template '__builtin_common_type'}}
----------------
AaronBallman wrote:

Other test cases to consider:
```
__builtin_common_type<1> a;
__builtin_common_type<int, 1> b;
```

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


More information about the libcxx-commits mailing list