1 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -fcuda-is-device %s
3 // Check how the force_cuda_host_device pragma interacts with template
7 auto foo() { // expected-note {{declared here}}
13 void foo(); // expected-note {{declared here}}
16 #pragma clang force_cuda_host_device begin
17 __attribute__((host)) __attribute__((device)) void test() {
18 int n = foo<int>(); // expected-error {{reference to __host__ function 'foo<int>'}}
19 X<int>().foo(); // expected-error {{reference to __host__ function 'foo'}}
21 #pragma clang force_cuda_host_device end
23 // Same thing as above, but within a force_cuda_host_device block without a
27 T bar() { // expected-note {{declared here}}
33 void bar(); // expected-note {{declared here}}
36 #pragma clang force_cuda_host_device begin
37 __attribute__((host)) __attribute__((device)) void test2() {
38 int n = bar<int>(); // expected-error {{reference to __host__ function 'bar<int>'}}
39 Y<int>().bar(); // expected-error {{reference to __host__ function 'bar'}}