1 // RUN: %clang_cc1 -std=c++11 -fcuda-is-device -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
4 #include "Inputs/cuda.h"
7 // expected-no-diagnostics
10 // When compiling for device, foo()'s call to host_fn() is an error, because
11 // foo() is known-emitted.
13 // The trickiness here comes from the fact that the FunctionDecl bar() sees
14 // foo() does not have the "inline" keyword, so we might incorrectly think that
15 // foo() is a priori known-emitted. This would prevent us from marking foo()
16 // as known-emitted when we see the call from bar() to foo(), which would
17 // prevent us from emitting an error for foo()'s call to host_fn() when we
22 // expected-note@-2 {{declared here}}
25 __host__ __device__ void foo();
26 __device__ void bar() {
29 // expected-note@-2 {{called by 'bar'}}
32 inline __host__ __device__ void foo() {
35 // expected-error@-2 {{reference to __host__ function}}
39 // This is similar to the above, except there's no error here. This code used
40 // to trip an assertion due to us noticing, when emitting the definition of
41 // boom(), that T::operator S() was (incorrectly) considered a priori
45 __device__ operator S() const;
47 __device__ inline T::operator S() const { return S(); }
50 __device__ void boom() {