diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-05 05:15:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-05 05:15:43 +0000 |
commit | dc81c880cad01f01888632d28345077336ca06a4 (patch) | |
tree | d65c305c0314cbb9be8cea0893f8d405a20e2812 | |
parent | b4a9c612f901a47135ea531f60db997d4cc4cdf5 (diff) |
When adding ADL candidates for overloaded
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
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 2 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-expr-1.cpp | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index c76cbca160..3af914475c 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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); diff --git a/test/SemaTemplate/instantiate-expr-1.cpp b/test/SemaTemplate/instantiate-expr-1.cpp index 34fc6af746..d1b05f66a5 100644 --- a/test/SemaTemplate/instantiate-expr-1.cpp +++ b/test/SemaTemplate/instantiate-expr-1.cpp @@ -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; }; |