HomePhabricator

[C++17] Fix PR34970 - tweak overload resolution for class template deduction…

Description

[C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides in line with WG21's p0620r0.

In order to identify the copy deduction candidate, I considered two approaches:

  • attempt to determine whether an implicit guide is a copy deduction candidate by checking certain properties of its subsituted parameter during overload-resolution.
  • using one of the many bits (WillHaveBody) from FunctionDecl (that CXXDeductionGuideDecl inherits from) that are otherwise irrelevant for deduction guides

After some brittle gymnastics w the first strategy, I settled on the second, although to avoid confusion and to give that bit a better name, i turned it into a member of an anonymous union.

Given this identification 'bit', the tweak to overload resolution was a simple reordering of the deduction guide checks (in SemaOverload.cpp::isBetterOverloadCandidate), in-line with Jason Merrill's p0620r0 drafting which made it into the working paper. Concordant with that, I made sure the copy deduction candidate is always added.

References:
See https://bugs.llvm.org/show_bug.cgi?id=34970
See http://wg21.link/p0620r0

Details

Committed
faisalvOct 22 2017, 7:45 AM
Parents
rL316291: shared: Implement aligned vector stores (vstorea_half)
Branches
Unknown
Tags
Unknown