1c24e6dd3SEric Fiselier //===----------------------------------------------------------------------===//
2c24e6dd3SEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6c24e6dd3SEric Fiselier //
7c24e6dd3SEric Fiselier //===----------------------------------------------------------------------===//
8c24e6dd3SEric Fiselier 
9000f25a3SEric Fiselier // This test should pass in C++03 with Clang extensions because Clang does
10000f25a3SEric Fiselier // not implicitly delete the copy constructor when move constructors are
11000f25a3SEric Fiselier // defaulted using extensions.
12000f25a3SEric Fiselier 
13*31cbe0f2SLouis Dionne // XFAIL: c++03
14c24e6dd3SEric Fiselier 
15c24e6dd3SEric Fiselier // test move
16c24e6dd3SEric Fiselier 
17c24e6dd3SEric Fiselier #include <utility>
18c24e6dd3SEric Fiselier #include <cassert>
19c24e6dd3SEric Fiselier 
20c24e6dd3SEric Fiselier struct move_only {
move_onlymove_only21c24e6dd3SEric Fiselier     move_only() {}
22c24e6dd3SEric Fiselier     move_only(move_only&&) = default;
23c24e6dd3SEric Fiselier     move_only& operator=(move_only&&) = default;
24c24e6dd3SEric Fiselier };
25c24e6dd3SEric Fiselier 
source()26c24e6dd3SEric Fiselier move_only source() {return move_only();}
csource()27c24e6dd3SEric Fiselier const move_only csource() {return move_only();}
28c24e6dd3SEric Fiselier 
test(move_only)29c24e6dd3SEric Fiselier void test(move_only) {}
30c24e6dd3SEric Fiselier 
main(int,char **)312df59c50SJF Bastien int main(int, char**)
32c24e6dd3SEric Fiselier {
33c24e6dd3SEric Fiselier   const move_only ca = move_only();
34000f25a3SEric Fiselier   // expected-error@+1 {{call to implicitly-deleted copy constructor of 'move_only'}}
35000f25a3SEric Fiselier   test(std::move(ca));
362df59c50SJF Bastien 
372df59c50SJF Bastien   return 0;
38c24e6dd3SEric Fiselier }
39