27 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -emit-llvm -triple x86_64-unknown-linux-gnu -o - %s | FileCheck %s2// RUN: %clang_cc1 -std=c++17 -emit-llvm -triple x86_64-unknown-linux-gnu -o - %s | FileCheck %s3// RUN: %clang_cc1 -std=c++14 -emit-llvm -triple x86_64-unknown-linux-gnu -o - %s | FileCheck %s4// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple x86_64-unknown-linux-gnu -o - %s | FileCheck %s5 6// - volatile object in return statement don't match the rule for using move7// operation instead of copy operation. Thus should call the copy constructor8// A(const volatile A &).9//10// - volatile object in return statement also don't match the rule for copy11// elision. Thus the copy constructor A(const volatile A &) cannot be elided.12namespace test_volatile {13class A {14public:15 A() {}16 ~A() {}17 A(const volatile A &);18 A(volatile A &&);19};20 21A test() {22 volatile A a_copy;23 // CHECK: call void @_ZN13test_volatile1AC1ERVKS0_24 return a_copy;25}26} // namespace test_volatile27