[Bug c++/88123] New: faulty qualified name lookup of overloaded operator within generic lambda via using-directive
logicstuffs at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 20 23:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88123
Bug ID: 88123
Summary: faulty qualified name lookup of overloaded operator
within generic lambda via using-directive
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: logicstuffs at gmail dot com
Target Milestone: ---
Consider this code:
struct bar {};
namespace foo
{
void operator+(bar) {}
} // namespace foo
int main()
{
using namespace foo;
auto l = [](auto x) { +x; };
l(bar());
}
Somewhere between versions 5.5.0 and 6.1.0 (not tested with 6.0), the operator+
(binary too) lookup inside starts to fail, and fails ever since. That is, in
the exact form as posted above.
The code compiles, if we do ANY of the following:
- refactor operator+ into a regular function
- put bar class in foo namespace
- make the lambda non-generic
- make the operator+ argument non-generic, i.e. auto l = [](auto) { +bar(); };
- change using-directive into using-declaration, i.e. using foo::operator+;
- put the using namespace directive inside the lambda's body
The inheritance mechanism of the available names in the scope of the lambda
from the outer scope seems to be broken.
More information about the Gcc-bugs
mailing list