brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · b1b4887 Raw
52 lines · plain
1// RUN: %clang_cc1 -std=gnu++11 -triple nvptx64-unknown-unknown -fsyntax-only -verify %s2// RUN: %clang_cc1 -std=gnu++11 -triple nvptx64-unknown-unknown -fcuda-is-device -fsyntax-only -verify %s3 4struct CopyableH {5  const CopyableH& operator=(const CopyableH& x) { return *this; }6};7struct CopyableD {8  __attribute__((device)) const CopyableD& operator=(const CopyableD x) { return *this; }9};10 11struct SimpleH {12  CopyableH b;13};14// expected-note@-3 2 {{candidate function (the implicit copy assignment operator) not viable: call to __host__ function from __device__ function}}15// expected-note@-4 2 {{candidate function (the implicit move assignment operator) not viable: call to __host__ function from __device__ function}}16 17struct SimpleD {18  CopyableD b;19};20// expected-note@-3 2 {{candidate function (the implicit copy assignment operator) not viable: call to __device__ function from __host__ function}}21// expected-note@-4 2 {{candidate function (the implicit move assignment operator) not viable: call to __device__ function from __host__ function}}22 23void foo1hh() {24  SimpleH a, b;25  a = b;26}27__attribute__((device)) void foo1hd() {28  SimpleH a, b;29  a = b; // expected-error {{no viable overloaded}}30}31void foo1dh() {32  SimpleD a, b;33  a = b; // expected-error {{no viable overloaded}}34}35__attribute__((device)) void foo1dd() {36  SimpleD a, b;37  a = b;38}39 40void foo2hh(SimpleH &a, SimpleH &b) {41  a = b;42}43__attribute__((device)) void foo2hd(SimpleH &a, SimpleH &b) {44  a = b; // expected-error {{no viable overloaded}}45}46void foo2dh(SimpleD &a, SimpleD &b) {47  a = b; // expected-error {{no viable overloaded}}48}49__attribute__((device)) void foo2dd(SimpleD &a, SimpleD &b) {50  a = b;51}52