]> granicus.if.org Git - clang/commitdiff
When adding ADL candidates for overloaded
authorDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 05:15:43 +0000 (05:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 05:15:43 +0000 (05:15 +0000)
post-increment/post-decrement operators, be sure to consider both
arguments. Fixes PR6237.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95361 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaTemplate/instantiate-expr-1.cpp

index c76cbca160dfa23e1bf6daa814bfd7cfb387bd5f..3af914475c817b45a23472dd98ad3a32abf2dbfd 100644 (file)
@@ -5528,7 +5528,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
 
   // Add candidates from ADL.
   AddArgumentDependentLookupCandidates(OpName, /*Operator*/ true,
-                                       Args, 1,
+                                       Args, NumArgs,
                                        /*ExplicitTemplateArgs*/ 0,
                                        CandidateSet);
 
index 34fc6af746d7d89df9e172203a41d40c0ca1a092..d1b05f66a5863fae1ed597143787d45e9a02d6ff 100644 (file)
@@ -87,6 +87,18 @@ void add(const T &x) {
   (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;
 };