Justin Lebar | 0fad0ba | 2016-09-30 17:14:48 +0000 | [diff] [blame] | 1 | // 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 | } |