blob: c51e0a2b9d9cc03825106c891abb1bc6a629f017 [file] [log] [blame]
Justin Lebar0fad0ba2016-09-30 17:14:48 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcuda-is-device -verify %s
3
4// expected-no-diagnostics
5
6__attribute__((device)) void device_fn() {}
7__attribute__((device)) void hd_fn() {}
8
9__attribute__((device)) void device_attr() {
10 ([]() __attribute__((device)) { device_fn(); })();
11 ([] __attribute__((device)) () { device_fn(); })();
12 ([] __attribute__((device)) { device_fn(); })();
13
14 ([&]() __attribute__((device)){ device_fn(); })();
15 ([&] __attribute__((device)) () { device_fn(); })();
16 ([&] __attribute__((device)) { device_fn(); })();
17
18 ([&](int) __attribute__((device)){ device_fn(); })(0);
19 ([&] __attribute__((device)) (int) { device_fn(); })(0);
20}
21
22__attribute__((host)) __attribute__((device)) void host_device_attrs() {
23 ([]() __attribute__((host)) __attribute__((device)){ hd_fn(); })();
24 ([] __attribute__((host)) __attribute__((device)) () { hd_fn(); })();
25 ([] __attribute__((host)) __attribute__((device)) { hd_fn(); })();
26
27 ([&]() __attribute__((host)) __attribute__((device)){ hd_fn(); })();
28 ([&] __attribute__((host)) __attribute__((device)) () { hd_fn(); })();
29 ([&] __attribute__((host)) __attribute__((device)) { hd_fn(); })();
30
31 ([&](int) __attribute__((host)) __attribute__((device)){ hd_fn(); })(0);
32 ([&] __attribute__((host)) __attribute__((device)) (int) { hd_fn(); })(0);
33}