• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // This test should pass in C++03 with Clang extensions because Clang does
10 // not implicitly delete the copy constructor when move constructors are
11 // defaulted using extensions.
12 
13 // XFAIL: c++03
14 
15 // test move
16 
17 #include <utility>
18 #include <cassert>
19 
20 struct move_only {
move_onlymove_only21     move_only() {}
22     move_only(move_only&&) = default;
23     move_only& operator=(move_only&&) = default;
24 };
25 
source()26 move_only source() {return move_only();}
csource()27 const move_only csource() {return move_only();}
28 
test(move_only)29 void test(move_only) {}
30 
main(int,char **)31 int main(int, char**)
32 {
33   const move_only ca = move_only();
34   // expected-error@+1 {{call to implicitly-deleted copy constructor of 'move_only'}}
35   test(std::move(ca));
36 
37   return 0;
38 }
39