[PATCH] D100794: [HIP] Support overloaded math functions for hipRTC

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 20 12:03:06 PDT 2021


yaxunl marked 2 inline comments as done.
yaxunl added inline comments.


================
Comment at: clang/lib/Headers/__clang_hip_cmath.h:341
 
-  typedef decltype(__test(std::declval<_Tp>())) type;
-  static const bool value = !std::is_same<type, void>::value;
+  typedef decltype(__test(_Tp{})) type;
+  static const bool value = !is_same<type, void>::value;
----------------
tra wrote:
> tra wrote:
> > @jlebar : Should we expect any observable surprises here?
> `_Tp{}` may break if `_Tp` does not have a default constructor. At least it does so with C++20, while the old code did not: https://godbolt.org/z/PGEff5Mvv
Right. It occurred to me that users may overload these math functions with arguments without default ctor, then we will hit the issue.

I will fix this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100794/new/

https://reviews.llvm.org/D100794



More information about the cfe-commits mailing list