Page MenuHomePhabricator

Added missing unqualified name lookup of operator overloads for fold expressions
Needs ReviewPublic

Authored by jonathanmeier on Sep 5 2019, 5:22 PM.


Group Reviewers
Restricted Project

Valid operator overloads for fold expressions are not found in the current scope, since unqualified name lookup is not performed.

This is a proposal to fix Bug 30590 (and its duplicates Bug 30738 and Bug 42518). The core issue is that fold expressions get expanded during template instantiation (second phase of name lookup) when the current scope is not available anymore (current scope is available in the first phase of name lookup, i.e. while parsing the template definition).

My approach is to attach to the fold expression the operator overload candidates found by the unqualified name lookup while parsing. During template instantiation these candidates are then considered when the fold expressions are expanded and the actual binary operations are built.

Please comment on whether you deem this a reasonable approach or if you know of a better way of solving the issue.

Diff Detail

Event Timeline

jonathanmeier created this revision.Sep 5 2019, 5:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 5 2019, 5:22 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript