[cfe-commits] r95361 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaTemplate/instantiate-expr-1.cpp

Douglas Gregor dgregor at apple.com
Thu Feb 4 21:16:03 PST 2010


Author: dgregor
Date: Thu Feb  4 23:15:43 2010
New Revision: 95361

URL: http://llvm.org/viewvc/llvm-project?rev=95361&view=rev
Log:
When adding ADL candidates for overloaded
post-increment/post-decrement operators, be sure to consider both
arguments. Fixes PR6237.


Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaTemplate/instantiate-expr-1.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=95361&r1=95360&r2=95361&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Feb  4 23:15:43 2010
@@ -5528,7 +5528,7 @@
 
   // Add candidates from ADL.
   AddArgumentDependentLookupCandidates(OpName, /*Operator*/ true,
-                                       Args, 1,
+                                       Args, NumArgs,
                                        /*ExplicitTemplateArgs*/ 0,
                                        CandidateSet);
 

Modified: cfe/trunk/test/SemaTemplate/instantiate-expr-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-expr-1.cpp?rev=95361&r1=95360&r2=95361&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-expr-1.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-expr-1.cpp Thu Feb  4 23:15:43 2010
@@ -87,6 +87,18 @@
   (void)(x + x);
 }
 
+namespace PR6237 {
+  template <typename T>
+  void f(T t) {
+    t++;
+  }
+
+  struct B { };
+  B operator++(B &, int);
+
+  template void f(B);
+}
+
 struct Addable {
   Addable operator+(const Addable&) const;
 };





More information about the cfe-commits mailing list