1 // RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -Wredundant-move -std=c++11 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3 // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -ast-dump | FileCheck %s --check-prefix=CHECK-AST
5 // definitions for std::move
8 template <class T
> struct remove_reference
{ typedef T type
; };
9 template <class T
> struct remove_reference
<T
&> { typedef T type
; };
10 template <class T
> struct remove_reference
<T
&&> { typedef T type
; };
12 template <class T
> typename remove_reference
<T
>::type
&&move(T
&&t
);
16 // test1 and test2 should not warn until after implementation of DR1579.
18 struct B
: public A
{};
48 // Copy of tests above with types changed to reference types.
57 C
test4(A
& a1
, B
& b1
) {
76 // Verify the implicit move from the AST dump
77 // CHECK-AST: ReturnStmt{{.*}}line:[[@LINE-2]]
78 // CHECK-AST-NEXT: CXXConstructExpr{{.*}}D{{.*}}void (D &&)
79 // CHECK-AST-NEXT: ImplicitCastExpr
80 // CHECK-AST-NEXT: DeclRefExpr{{.*}}ParmVar{{.*}}'d'
83 // expected-warning@-1{{redundant move in return statement}}
84 // expected-note@-2{{remove std::move call here}}
85 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:20}:""
86 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:22}:""
93 // Warn once here since the type is not dependent.
97 // expected-warning@-1{{redundant move in return statement}}
98 // expected-note@-2{{remove std::move call here}}
99 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:12-[[@LINE-3]]:22}:""
100 // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:23-[[@LINE-4]]:24}:""
107 // T1 and T2 may not be the same, the warning may not always apply.
108 template <typename T1
, typename T2
>