[PATCH] D35297: [Sema] Fix operator lookup to consider local extern declarations.
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 03:37:54 PDT 2017
EricWF updated this revision to Diff 106168.
EricWF edited the summary of this revision.
https://reviews.llvm.org/D35297
Files:
lib/Sema/SemaLookup.cpp
test/SemaCXX/overloaded-operator.cpp
Index: test/SemaCXX/overloaded-operator.cpp
===================================================================
--- test/SemaCXX/overloaded-operator.cpp
+++ test/SemaCXX/overloaded-operator.cpp
@@ -531,3 +531,20 @@
b3 / 0; // expected-note {{in instantiation of}} expected-error {{invalid operands to}}
}
}
+
+
+namespace PR27027 {
+ template <class T> void operator+(T, T) = delete; // expected-note 2 {{candidate}}
+ template <class T> void operator+(T) = delete; // expected-note 2 {{candidate}}
+
+ struct A {};
+ void f() {
+ A a;
+ +a; // expected-error {{overload resolution selected deleted operator '+'}}
+ a + a; // expected-error {{overload resolution selected deleted operator '+'}}
+ void operator+(A);
+ void operator+(A, A);
+ +a; // OK
+ a + a;
+ }
+}
Index: lib/Sema/SemaLookup.cpp
===================================================================
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -226,7 +226,7 @@
// Operator lookup is its own crazy thing; it is not the same
// as (e.g.) looking up an operator name for redeclaration.
assert(!Redeclaration && "cannot do redeclaration operator lookup");
- IDNS = Decl::IDNS_NonMemberOperator;
+ IDNS = Decl::IDNS_NonMemberOperator | Decl::IDNS_LocalExtern;
break;
case Sema::LookupTagName:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35297.106168.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170712/74ed457c/attachment.bin>
More information about the cfe-commits
mailing list