c++: Fix ICE with lambda in operator function [PR93597]
authorMarek Polacek <polacek@redhat.com>
Wed, 5 Feb 2020 17:53:06 +0000 (12:53 -0500)
committerMarek Polacek <polacek@redhat.com>
Thu, 6 Feb 2020 16:58:23 +0000 (11:58 -0500)
commit4a136a214ede91ef05caac017814b142883dc80d
tree2fbaaf508ba18858fb6293c4f6c29204515e24da
parentf78335df69993a900512f92324cab6a20b1bde0c
c++: Fix ICE with lambda in operator function [PR93597]

If we are going to use get_first_fn let's make sure we operate on
is_overloaded_fn, as the rest of the codebase does, and if lookup finds
any class-scope declaration, return early too.

PR c++/93597 - ICE with lambda in operator function.
* name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.

* g++.dg/cpp0x/lambda/lambda-93597.C: New test.
gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-93597.C [new file with mode: 0644]