[PATCH] D13289: [libc++] Provide additional templates for valarray transcendentals that satisfy the standard synopsis

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 00:15:30 PDT 2015


EricWF added a subscriber: EricWF.
EricWF added reviewers: EricWF, mclow.lists.
EricWF added a comment.

> This is required by the standard and is needed if the user tries to explicitly instantiate the transcendental functions using _Tp, for example, std::abs<int>(int_valarray).


These may in fact be required by the standard but not for the reason you say. The standard essentially prohibits users from doing anything with standard library functions other than calling them with a list of arguments. This includes specifying default template parameters. The relevant text from the current C++ draft:

> [17.6.5.4] global.functions`

> 

> 2. A call to a global or non-member function signature described in Clauses 18 through 30 and Annex D shall behave as if the implementation declared no additional global or non-member function signatures


However the overloads you need are required for standard conformance because they provide an interface that requires an implicit conversion to `valarray<Tp>` be performed. This subtly changes its ranking in overload resolution. For this reason we need this patch.

At first look this patch looks good, and it adds lots of tests which is even better.


http://reviews.llvm.org/D13289





More information about the cfe-commits mailing list