This is an archive of the discontinued LLVM Phabricator instance.

Fix floating point promotions for overload purposes
Needs ReviewPublic

Authored by t.p.northover on Jun 28 2017, 2:16 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This has a couple of changes to how Clang determines whether a floating-point promotion has occurred for C++ (and __attribute__((overloadable))) purposes.

First, I think the special rules for C are based on a misconception. C99 referred to promotions to "long double" but it actually meant conversions, and the only real promotions that happened were the "float -> double" default argument promotion for varargs (and obviously nothing to do with overload resolution). C11 fixed this wording to remove all mention of promotions. So this patch makes all overload resolution follow C++ rules, which seems like the least surprising behaviour for attribute((overloadable)).

Second, this allows "half -> double" promotion unconditionally. Since half is a non-standard type there's a bit of guesswork here, but it seems like the most consistent extension of C++'s wording to that type (with special mention going to allowing "half -> float" too). It definitely seems reasonable that the decision should not depend on NativeHalfTypes.

Does the change look reasonable to others?

Diff Detail

Repository
rL LLVM

Event Timeline

t.p.northover created this revision.Jun 28 2017, 2:16 PM