xref: /aosp_15_r20/external/clang/test/SemaCUDA/addr-of-overloaded-fn.cu (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // expected-no-diagnostics
2*67e74705SXin Li 
3*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
4*67e74705SXin Li // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only -fcuda-is-device -verify %s
5*67e74705SXin Li 
6*67e74705SXin Li #include "Inputs/cuda.h"
7*67e74705SXin Li 
overload()8*67e74705SXin Li __host__ void overload() {}
overload()9*67e74705SXin Li __device__ void overload() {}
10*67e74705SXin Li 
test_hd()11*67e74705SXin Li __host__ __device__ void test_hd() {
12*67e74705SXin Li   // This should not be ambiguous -- we choose the host or the device overload
13*67e74705SXin Li   // depending on whether or not we're compiling for host or device.
14*67e74705SXin Li   void (*x)() = overload;
15*67e74705SXin Li }
16*67e74705SXin Li 
17*67e74705SXin Li // These also shouldn't be ambiguous, but they're an easier test than the HD
18*67e74705SXin Li // function above.
test_host()19*67e74705SXin Li __host__ void test_host() {
20*67e74705SXin Li   void (*x)() = overload;
21*67e74705SXin Li }
test_device()22*67e74705SXin Li __device__ void test_device() {
23*67e74705SXin Li   void (*x)() = overload;
24*67e74705SXin Li }
25