]> granicus.if.org Git - clang/commitdiff
Produce a warning that partial ordering of function templates is not yet supported
authorDouglas Gregor <dgregor@apple.com>
Sun, 2 Aug 2009 23:46:29 +0000 (23:46 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 2 Aug 2009 23:46:29 +0000 (23:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77928 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaOverload.cpp

index 25e331721ae8f021bf82b05fa053e131924d056f..a4e8f569547bae41e4a7b7ff2ed08795118a5109 100644 (file)
@@ -905,6 +905,10 @@ def unsup_template_partial_spec_ordering : Error<
   "partial ordering of class template partial specializations is not yet "
   "supported">;
 
+def unsup_function_template_partial_ordering : Warning<
+  "partial ordering of function templates is unsupported; overload resolution "
+  "may result in an ambiguity that would not occur with a conforming compiler">;
+  
 // C++ Template Instantiation
 def err_template_recursion_depth_exceeded : Error<
   "recursive template instantiation exceeded maximum depth of %0">,
index 0880d1073d6f2db4858ae11e0001d6dc234583c5..75ca531cbcdbca522f7d3f734266a8b2e3e29d22 100644 (file)
@@ -3496,8 +3496,10 @@ Sema::isBetterOverloadCandidate(const OverloadCandidate& Cand1,
   //      template for F1 is more specialized than the template for F2 
   //      according to the partial ordering rules described in 14.5.5.2, or, 
   //      if not that,
-  
-  // FIXME: Implement partial ordering of function templates.
+  if (Cand1.Function && Cand1.Function->getPrimaryTemplate() &&
+      Cand2.Function && Cand2.Function->getPrimaryTemplate())
+    // FIXME: Implement partial ordering of function templates.
+    Diag(SourceLocation(), diag::unsup_function_template_partial_ordering);
 
   //   -- the context is an initialization by user-defined conversion
   //      (see 8.5, 13.3.1.5) and the standard conversion sequence