llvm-project/clang/test/SemaOpenCLCXX/temporaries.clcpp
Ole Strohm 8008009fd2 [OpenCL] Initialize temporaries in the private address space
This patch fixes initializing temporaries, which are currently initialized
without an address space, meaning that no constructor can ever be applicable.
Now they will be constructed in the private addrspace.

Fixes the second issue in PR43296.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D107553
2021-09-13 12:56:04 +01:00

20 lines
418 B
Plaintext

// RUN: %clang_cc1 %s -pedantic -ast-dump | FileCheck %s
struct X {
X() __private = default;
};
// CHECK: VarDecl {{.*}} gx
// CHECK: CXXTemporaryObjectExpr {{.*}} '__private X'
__global X gx = X();
void k() {
// CHECK: VarDecl {{.*}} x1
// CHECK: CXXTemporaryObjectExpr {{.*}} '__private X'
X x1 = X();
// CHECK: VarDecl {{.*}} x2
// CHECK: CXXConstructExpr {{.*}} 'const __private X'
const X x2;
}