61 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3#include "Inputs/cuda.h"4 5//------------------------------------------------------------------------------6// Test 1: collision between two bases7 8struct A1_with_host_ctor {9 A1_with_host_ctor() {}10};11 12struct B1_with_device_ctor {13 __device__ B1_with_device_ctor() {}14};15 16struct C1_with_collision : A1_with_host_ctor, B1_with_device_ctor {17};18 19// expected-note@-3 {{candidate constructor (the implicit default constructor}} not viable20// expected-note@-4 {{implicit default constructor inferred target collision: call to both __host__ and __device__ members}}21// expected-note@-5 {{candidate constructor (the implicit copy constructor}} not viable22// expected-note@-6 {{candidate constructor (the implicit move constructor) not viable}}23 24void hostfoo1() {25 C1_with_collision c; // expected-error {{no matching constructor}}26}27 28//------------------------------------------------------------------------------29// Test 2: collision between two fields30 31struct C2_with_collision {32 A1_with_host_ctor aa;33 B1_with_device_ctor bb;34};35 36// expected-note@-5 {{candidate constructor (the implicit default constructor}} not viable37// expected-note@-6 {{implicit default constructor inferred target collision: call to both __host__ and __device__ members}}38// expected-note@-7 {{candidate constructor (the implicit copy constructor}} not viable39// expected-note@-8 {{candidate constructor (the implicit move constructor) not viable}}40 41void hostfoo2() {42 C2_with_collision c; // expected-error {{no matching constructor}}43 44}45 46//------------------------------------------------------------------------------47// Test 3: collision between a field and a base48 49struct C3_with_collision : A1_with_host_ctor {50 B1_with_device_ctor bb;51};52 53// expected-note@-4 {{candidate constructor (the implicit default constructor}} not viable54// expected-note@-5 {{implicit default constructor inferred target collision: call to both __host__ and __device__ members}}55// expected-note@-6 {{candidate constructor (the implicit copy constructor}} not viable56// expected-note@-7 {{candidate constructor (the implicit move constructor) not viable}}57 58void hostfoo3() {59 C3_with_collision c; // expected-error {{no matching constructor}}60}61