Home | History | Annotate | Download | only in SemaCUDA
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 #include "cuda.h"
      4 
      5 __host__ void h1h(void);
      6 __device__ void h1d(void); // expected-note {{candidate function not viable: call to __device__ function from __host__ function}}
      7 __host__ __device__ void h1hd(void);
      8 __global__ void h1g(void);
      9 
     10 struct h1ds { // expected-note {{requires 1 argument}}
     11   __device__ h1ds(); // expected-note {{candidate constructor not viable: call to __device__ function from __host__ function}}
     12 };
     13 
     14 __host__ void h1(void) {
     15   h1h();
     16   h1d(); // expected-error {{no matching function}}
     17   h1hd();
     18   h1g<<<1, 1>>>();
     19   h1ds x; // expected-error {{no matching constructor}}
     20 }
     21 
     22 __host__ void d1h(void); // expected-note {{candidate function not viable: call to __host__ function from __device__ function}}
     23 __device__ void d1d(void);
     24 __host__ __device__ void d1hd(void);
     25 __global__ void d1g(void); // expected-note {{'d1g' declared here}}
     26 
     27 __device__ void d1(void) {
     28   d1h(); // expected-error {{no matching function}}
     29   d1d();
     30   d1hd();
     31   d1g<<<1, 1>>>(); // expected-error {{reference to __global__ function 'd1g' in __device__ function}}
     32 }
     33 
     34 __host__ void hd1h(void); // expected-note {{candidate function not viable: call to __host__ function from __host__ __device__ function}}
     35 __device__ void hd1d(void); // expected-note {{candidate function not viable: call to __device__ function from __host__ __device__ function}}
     36 __host__ __device__ void hd1hd(void);
     37 __global__ void hd1g(void); // expected-note {{'hd1g' declared here}}
     38 
     39 __host__ __device__ void hd1(void) {
     40   hd1h(); // expected-error {{no matching function}}
     41   hd1d(); // expected-error {{no matching function}}
     42   hd1hd();
     43   hd1g<<<1, 1>>>(); // expected-error {{reference to __global__ function 'hd1g' in __host__ __device__ function}}
     44 }
     45