Clang Project

clang_source_code/test/PCH/pragma-cuda-force-host-device.cu
1// RUN: %clang_cc1 -emit-pch %s -o %t
2// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -include-pch %t -fsyntax-only %s
3
4#ifndef HEADER
5#define HEADER
6
7#pragma clang force_cuda_host_device begin
8#pragma clang force_cuda_host_device begin
9#pragma clang force_cuda_host_device end
10
11void hd1() {}
12
13#else
14
15void hd2() {}
16
17#pragma clang force_cuda_host_device end
18
19void host_only() {}
20
21__attribute__((device)) void device() {
22  hd1();
23  hd2();
24  host_only(); // expected-error {{no matching function for call}}
25}
26
27#endif
28