[PATCH] D67247: Added missing unqualified name lookup of operator overloads for fold expressions
Jonathan Meier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 17:23:26 PDT 2019
jonathanmeier created this revision.
jonathanmeier added reviewers: clang, rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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 <https://bugs.llvm.org/show_bug.cgi?id=30590> (and its duplicates Bug 30738 <https://bugs.llvm.org/show_bug.cgi?id=30738> and Bug 42518 <https://bugs.llvm.org/show_bug.cgi?id=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.
Repository:
rC Clang
https://reviews.llvm.org/D67247
Files:
clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/UnresolvedSet.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaTemplateVariadic.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/SemaTemplate/cxx1z-fold-expressions.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67247.219005.patch
Type: text/x-patch
Size: 22578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190906/f8452ddb/attachment-0001.bin>
More information about the cfe-commits
mailing list