1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 #include "Inputs/cuda.h"
5 //------------------------------------------------------------------------------
6 // Test 1: collision between two bases
8 struct A1_with_host_ctor {
12 struct B1_with_device_ctor {
13 __device__ B1_with_device_ctor() {}
16 struct C1_with_collision : A1_with_host_ctor, B1_with_device_ctor {
19 // expected-note@-3 {{candidate constructor (the implicit default constructor}} not viable
20 // 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 viable
22 // expected-note@-6 {{candidate constructor (the implicit move constructor) not viable}}
25 C1_with_collision c; // expected-error {{no matching constructor}}
28 //------------------------------------------------------------------------------
29 // Test 2: collision between two fields
31 struct C2_with_collision {
33 B1_with_device_ctor bb;
36 // expected-note@-5 {{candidate constructor (the implicit default constructor}} not viable
37 // 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 viable
39 // expected-note@-8 {{candidate constructor (the implicit move constructor) not viable}}
42 C2_with_collision c; // expected-error {{no matching constructor}}
46 //------------------------------------------------------------------------------
47 // Test 3: collision between a field and a base
49 struct C3_with_collision : A1_with_host_ctor {
50 B1_with_device_ctor bb;
53 // expected-note@-4 {{candidate constructor (the implicit default constructor}} not viable
54 // 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 viable
56 // expected-note@-7 {{candidate constructor (the implicit move constructor) not viable}}
59 C3_with_collision c; // expected-error {{no matching constructor}}