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

There are two cases where `lookUpCommonType` is called:
- `sizeof...(Ts)` is 1 - in that case we now call `commonTypeImpl` with two 
types
- `sizeof...(Ts)` is 2 and `decay_t<T1/T2>` is a different type that `T1/T2` - 
we now call `commonTypeImpl` with the decayed types instead, which won't go 
into the same branch, since a decayed type doesn't decay any further.

https://github.com/llvm/llvm-project/pull/99473
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to