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

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 25 13:06:06 PDT 2024


================
@@ -3058,6 +3058,133 @@ void Sema::NoteAllFoundTemplates(TemplateName Name) {
   }
 }
 
+static QualType commonTypeImpl(Sema &S, TemplateName BaseTemplate,
+                               SourceLocation TemplateLoc,
+                               ArrayRef<TemplateArgument> Ts) {
+  auto lookUpCommonType = [&](TemplateArgument T1,
+                              TemplateArgument T2) -> QualType {
+    // Don't bother looking for other specializations if both types are
+    // builtins - users aren't allowed to specialize for them
----------------
cjdb wrote:

We need to handle the first case in this patch because it is currently silently changing the outcome of `common_type<builtin, builtin>`. Although the standard gives us licence to silently change this, it isn't fair to users who either weren't aware of the consequences of specialising this, or are depending on such code.

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


More information about the libcxx-commits mailing list