This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61161] New: wrong two-stage name lookup for overloaded operators
- From: "richard-gccbugzilla at metafoo dot co.uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 May 2014 21:09:34 +0000
- Subject: [Bug c++/61161] New: wrong two-stage name lookup for overloaded operators
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61161
Bug ID: 61161
Summary: wrong two-stage name lookup for overloaded operators
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
GCC rejects-valid on this:
struct T {
template<typename T> void f(const T &v) {
0 << v;
}
};
namespace N {
struct X {};
struct Y : X {};
void operator<<(int, const X&) {}
}
void operator<<(int, const N::Y&) = delete;
int main() {
N::Y d;
T().f(d);
}
This is valid because the deleted operator<< is found by neither unqualified
lookup (within the template) or argument-dependent lookup (which searches
namespace N and not the global namespace).
This seems to be specific to operator syntax; if 'f' is changed to
operator<<(0, v);
then the code is accepted.