xref: /llvm-project/clang/test/SemaCUDA/function-redclare.cu (revision 53d2f4d967838468423715178a8344739d7a63c9)
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only \
2 // RUN:   -isystem %S/Inputs -verify %s
3 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only \
4 // RUN:   -isystem %S/Inputs -fcuda-is-device -verify %s
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only \
6 // RUN:   -isystem %S/Inputs -verify=redecl -Wnvcc-compat %s
7 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fsyntax-only \
8 // RUN:   -isystem %S/Inputs -fcuda-is-device -Wnvcc-compat -verify=redecl %s
9 
10 // expected-no-diagnostics
11 #include "cuda.h"
12 
13 __device__ void f(); // redecl-note {{previous declaration is here}}
14 
f()15 void f() {} // redecl-warning {{target-attribute based function overloads are not supported by NVCC and will be treated as a function redeclaration:new declaration is __host__ function, old declaration is __device__ function}}
16 
17 void g(); // redecl-note {{previous declaration is here}}
18 
g()19 __device__ void g() {} // redecl-warning {{target-attribute based function overloads are not supported by NVCC and will be treated as a function redeclaration:new declaration is __device__ function, old declaration is __host__ function}}
20