brintos

brintos / llvm-project-archived public Read only

0
0
Text · 933 B · 20107b3 Raw
34 lines · plain
1// RUN: %clang_cc1 -std=c++11 -triple nvptx64-nvidia-cuda -fsyntax-only \2// RUN:            -fcuda-is-device -verify=dev %s3// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -fsyntax-only \4// RUN:            -verify=host %s5 6// host-no-diagnostics7 8#include "Inputs/cuda.h"9 10struct A {11  A(); // dev-note 2{{'A' declared here}}12};13 14template <class T, int x> struct B {15  T a;16  constexpr B() = default; // dev-error 2{{reference to __host__ function 'A' in __host__ __device__ function}}17};18 19__host__ void f() { B<A, 1> x; }20__device__ void f() { B<A, 1> x; } // dev-note{{called by 'f'}}21 22struct foo {23  __host__ foo() { B<A, 2> x; }24  __device__ foo() { B<A, 2> x; } // dev-note{{called by 'foo'}}25};26 27__host__ void g() { foo x; }28__device__ void g() { foo x; } // dev-note{{called by 'g'}}29 30struct bar {31  __host__ bar() { B<A, 3> x; }32  __device__ bar() { B<A, 3> x; } // no error since no instantiation of bar33};34