[PATCH] D13289: [libc++] Provide additional templates for valarray transcendentals that satisfy the standard synopsis
Petr Pavlu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 18 03:06:47 PST 2015
petpav01 updated this revision to Diff 40486.
petpav01 added a comment.
I am not sure if I understand the comment about [17.6.5.4] correctly. It is not clear to me how this part of the standard prevents the user from specifying explicit template parameters for standard functions. It seems odd that the standard would disallow, for example, to use `std::max<double>(1, 2.0)`.
New patch changes the transcendentals that accepted any `Expr` (i.e. `valarray` or `__val_expr`) to only accept `__val_expr`. In two cases (`atan2()` and `pow()`) the original template had to be split into four functions:
- `func(const __val_expr&, const __val_expr&)`
- `func(const __val_expr&, const valarray&)`
- `func(const valarray&, const __val_expr&)`
- `func(const valarray&, const valarray&)`
`is_same` checks on `value_type` of both operands are also added in these cases.
Missing thing is a better test coverage. The tests currently do not instantiate the `__val_expr` templates. I am working on this. Could you please send me an example that shows the problem with the ranking in overload resolution so I can add a test for it too?
http://reviews.llvm.org/D13289
Files:
include/valarray
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13289.40486.patch
Type: text/x-patch
Size: 55804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151118/d7daaf40/attachment-0001.bin>
More information about the cfe-commits
mailing list