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

Christopher Di Bella via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 13:45:57 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:

Good point. There are only a handful of cases that this applies to, but they should also break loudly. In that case, I'd prefer it if getting that diagnostic logic into Clang preceded submitting this PR.

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


More information about the cfe-commits mailing list