blob: 6064708aaa3dbc925eb54aee3b171d66e42027fa [file] [log] [blame]
Justin Lebar67a78a62016-10-08 22:15:58 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// Check the force_cuda_host_device pragma.
4
5#pragma clang force_cuda_host_device begin
6void f();
7#pragma clang force_cuda_host_device begin
8void g();
9#pragma clang force_cuda_host_device end
10void h();
11#pragma clang force_cuda_host_device end
12
13void i(); // expected-note {{not viable}}
14
15void host() {
16 f();
17 g();
18 h();
19 i();
20}
21
22__attribute__((device)) void device() {
23 f();
24 g();
25 h();
26 i(); // expected-error {{no matching function}}
27}
28
29#pragma clang force_cuda_host_device foo
30// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
31
32#pragma clang force_cuda_host_device
33// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
34
35#pragma clang force_cuda_host_device begin foo
36// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}