brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 3434b2b Raw
39 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// This test should pass in C++03 with Clang extensions because Clang does10// not implicitly delete the copy constructor when move constructors are11// defaulted using extensions.12 13// XFAIL: c++0314 15// test move16 17#include <utility>18#include <cassert>19 20struct move_only {21    move_only() {}22    move_only(move_only&&) = default;23    move_only& operator=(move_only&&) = default;24};25 26move_only source() {return move_only();}27const move_only csource() {return move_only();}28 29void test(move_only) {}30 31int 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