| 1 |
// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify %s |
| 2 |
// RUN: %clang_cc1 -fopenmp -fexceptions -fsyntax-only -verify %s |
| 3 |
|
| 4 |
#include "Inputs/cuda.h" |
| 5 |
|
| 6 |
__device__ void foo(int) {} // expected-note {{candidate function not viable: call to __device__ function from __host__ function}} |
| 7 |
// expected-note@-1 {{'foo' declared here}} |
| 8 |
|
| 9 |
int main() { |
| 10 |
#pragma omp parallel |
| 11 |
for (int i = 0; i < 100; i++) { |
| 12 |
foo(1); // expected-error {{no matching function for call to 'foo'}} |
| 13 |
new int; |
| 14 |
} |
| 15 |
|
| 16 |
auto Lambda = []() { |
| 17 |
#pragma omp parallel |
| 18 |
for (int i = 0; i < 100; i++) { |
| 19 |
foo(1); // expected-error {{reference to __device__ function 'foo' in __host__ __device__ function}} |
| 20 |
new int; |
| 21 |
} |
| 22 |
}; |
| 23 |
Lambda(); // expected-note {{called by 'main'}} |
| 24 |
} |