[PATCH] D87563: [Sema] Improve overload resolution
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 12 10:09:21 PDT 2020
Mordante created this revision.
Mordante added reviewers: lvoufo, rsmith.
Mordante added a project: clang.
Mordante requested review of this revision.
The overload resolution for initializer lists was incomplete. It did not
properly take the number of elements in the target array into account. The
size comparison already allows for an array of unknown boud, per P0338 'Permit
conversions to arrays of unknown bound'. However currently this is dead code.
This fixes the overload resolution for cases like:
void f(int(&&)[2]);
void g() {
f({1});
f({1, 2});
f({1, 2, 3});
}
The patch adds extra members to `ImplicitConversionSequence`, making it larger
for members only used for an initializer list. The largest member of the class'
union is `UserDefinedConversion`. An initializer list can be used with a user
defined conversion sequence, so it's not possible to use unused space in the
union. I'm open to suggestions how to avoid the enlargement of the class.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87563
Files:
clang/include/clang/Sema/Overload.h
clang/lib/Sema/SemaOverload.cpp
clang/test/SemaCXX/overload-call.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87563.291402.patch
Type: text/x-patch
Size: 9249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200912/42ee8ad7/attachment-0001.bin>
More information about the cfe-commits
mailing list