Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / SemaCUDA / implicit-member-target-collision.cu
bloba50fddaa4615b22cb6ed6efd939f99f61bbc982c
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 {
9   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}}
24 void hostfoo1() {
25   C1_with_collision c; // expected-error {{no matching constructor}}
28 //------------------------------------------------------------------------------
29 // Test 2: collision between two fields
31 struct C2_with_collision {
32   A1_with_host_ctor aa;
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}}
41 void hostfoo2() {
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}}
58 void hostfoo3() {
59   C3_with_collision c; // expected-error {{no matching constructor}}