build/clang-plugin/tests/TestNoExplicitMoveConstructor.cpp
author Michael Layzell <michael@thelayzells.com>
Thu, 03 Sep 2015 10:31:57 -0400
changeset 262173 63f3a49b15cbce9c99a4ba7f8fce2602dfc0b3ed
permissions -rw-r--r--
Bug 1156802 - Part 1: Add an analysis which prohibits explicit move constructors, r=ehsan

class Foo {
  Foo(Foo&& f);
};

class Bar {
  explicit Bar(Bar&& f); // expected-error {{Move constructors may not be marked explicit}}
};

class Baz {
  template<typename T>
  explicit Baz(T&& f) {};
};

class Quxx {
  Quxx();
  Quxx(Quxx& q) = delete;
  template<typename T>
  explicit Quxx(T&& f) {};
};

void f() {
  // Move a quxx into a quxx! (This speciailizes Quxx's constructor to look like
  // a move constructor - to make sure it doesn't trigger)
  Quxx(Quxx());
}