yaxunl added a comment.

In D77954#2005313 <https://reviews.llvm.org/D77954#2005313>, @gribozavr2 wrote:

> Sorry -- this change broke overload resolution for `operator new`, as it is 
> declared in system headers. I'm reverting the patch.
>
>   $ cat /tmp/in.cu.cc
>   #define __device__ __attribute__((device))
>   void* operator new(__SIZE_TYPE__ size);
>   __device__ void *operator new(__SIZE_TYPE__ size);
>   void *x = new int;
>   $ clang -fsyntax-only --cuda-device-only --target=x86_64-grtev4-linux-gnu 
> -x cuda -nocudalib -nocudainc -std=gnu++17 /tmp/in.cu.cc
>   /tmp/in.cu.cc:4:11: error: call to 'operator new' is ambiguous
>   void *x = new int;
>             ^
>   /tmp/in.cu.cc:2:7: note: candidate function
>   void* operator new(__SIZE_TYPE__ size);
>         ^
>   /tmp/in.cu.cc:3:18: note: candidate function
>   __device__ void *operator new(__SIZE_TYPE__ size);
>                    ^
>   1 error generated when compiling for sm_20.
>


Thanks. Fixed in https://reviews.llvm.org/D78970


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77954



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to