Here the problem was that we were remembering the lookup in template scope,
and then trying to reuse that lookup in the instantiation without
substituting into it at all. The simplest solution is to not try to
remember a lookup that finds a class-scope declaration, as in that case
doing the normal lookup again at instantiation time will always find the
right declarations.
PR c++/93279 - ICE with lambda in member operator.
* name-lookup.c (maybe_save_operator_binding): Don't remember
class-scope bindings.
+2020-01-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/93279 - ICE with lambda in member operator.
+ * name-lookup.c (maybe_save_operator_binding): Don't remember
+ class-scope bindings.
+
2020-01-24 Jason Merrill <jason@redhat.com>
PR c++/93377 - ICE with member alias in constraint.
if (!fns && (fns = op_unqualified_lookup (fnname)))
{
+ tree fn = get_first_fn (fns);
+ if (DECL_CLASS_SCOPE_P (fn))
+ /* We don't need to remember class-scope functions, normal unqualified
+ lookup will find them again. */
+ return;
+
bindings = tree_cons (fnname, fns, bindings);
if (attr)
TREE_VALUE (attr) = bindings;
--- /dev/null
+// PR c++/93279
+// { dg-do compile { target c++11 } }
+
+template <typename T> struct B { using f = int; };
+template <typename T, int N> struct E {
+ template <typename U, typename B<E>::f = 0>
+ void operator*(U l) { [l](T m) { m * l; }; }
+};
+
+int
+main ()
+{
+ E<E<float, 4>, 1> n;
+ n * 4.f;
+}