summaryrefslogtreecommitdiff
path: root/test/PCH/pragma-cuda-force-host-device.cu
diff options
context:
space:
mode:
Diffstat (limited to 'test/PCH/pragma-cuda-force-host-device.cu')
-rw-r--r--test/PCH/pragma-cuda-force-host-device.cu27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/PCH/pragma-cuda-force-host-device.cu b/test/PCH/pragma-cuda-force-host-device.cu
new file mode 100644
index 0000000000..dc006be960
--- /dev/null
+++ b/test/PCH/pragma-cuda-force-host-device.cu
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -emit-pch %s -o %t
+// RUN: %clang_cc1 -verify -verify-ignore-unexpected=note -include-pch %t -S -o /dev/null %s
+
+#ifndef HEADER
+#define HEADER
+
+#pragma clang force_cuda_host_device begin
+#pragma clang force_cuda_host_device begin
+#pragma clang force_cuda_host_device end
+
+void hd1() {}
+
+#else
+
+void hd2() {}
+
+#pragma clang force_cuda_host_device end
+
+void host_only() {}
+
+__attribute__((device)) void device() {
+ hd1();
+ hd2();
+ host_only(); // expected-error {{no matching function for call}}
+}
+
+#endif