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