172315d02SRichard Smith // RUN: %clang_cc1 -fsyntax-only -verify -Wall -std=c++11 %s -Wno-unused-value 270b1f6deSCorentin Jabot 370b1f6deSCorentin Jabot namespace std { 470b1f6deSCorentin Jabot 570b1f6deSCorentin Jabot template <typename T> dummy(T &&)670b1f6deSCorentin Jabotvoid dummy(T &&) {} 770b1f6deSCorentin Jabot template <typename T> move(T && x)872315d02SRichard SmithT &&move(T &&x) { return x; } 970b1f6deSCorentin Jabot template <typename T, typename U> move(T &&,U &&)1070b1f6deSCorentin Jabotvoid move(T &&, U &&) {} 1170b1f6deSCorentin Jabot 1270b1f6deSCorentin Jabot inline namespace __1 { 1370b1f6deSCorentin Jabot template <typename T> forward(T & x)1472315d02SRichard SmithT &forward(T &x) { return x; } 1570b1f6deSCorentin Jabot } // namespace __1 1670b1f6deSCorentin Jabot 1770b1f6deSCorentin Jabot struct foo {}; 1870b1f6deSCorentin Jabot 1970b1f6deSCorentin Jabot } // namespace std 2070b1f6deSCorentin Jabot 2170b1f6deSCorentin Jabot namespace global { 2270b1f6deSCorentin Jabot 2370b1f6deSCorentin Jabot using namespace std; 2470b1f6deSCorentin Jabot f()2570b1f6deSCorentin Jabotvoid f() { 2670b1f6deSCorentin Jabot int i = 0; 2770b1f6deSCorentin Jabot std::move(i); 28*f6a5ab6cSRichard Smith move(i); // expected-warning{{unqualified call to 'std::move'}} 29*f6a5ab6cSRichard Smith (move)(i); // expected-warning{{unqualified call to 'std::move'}} 3070b1f6deSCorentin Jabot std::dummy(1); 3170b1f6deSCorentin Jabot dummy(1); 3270b1f6deSCorentin Jabot std::move(1, 2); 3370b1f6deSCorentin Jabot move(1, 2); 34*f6a5ab6cSRichard Smith forward<int>(i); // expected-warning{{unqualified call to 'std::forward'}} 3570b1f6deSCorentin Jabot std::forward<int>(i); 3670b1f6deSCorentin Jabot } 3770b1f6deSCorentin Jabot 3870b1f6deSCorentin Jabot template <typename T> g(T && foo)3970b1f6deSCorentin Jabotvoid g(T &&foo) { 4070b1f6deSCorentin Jabot std::move(foo); 41*f6a5ab6cSRichard Smith move(foo); // expected-warning{{unqualified call to 'std::move}} 4270b1f6deSCorentin Jabot 4370b1f6deSCorentin Jabot std::forward<decltype(foo)>(foo); 44*f6a5ab6cSRichard Smith forward<decltype(foo)>(foo); // expected-warning{{unqualified call to 'std::forward}} 4570b1f6deSCorentin Jabot move(1, 2); 4670b1f6deSCorentin Jabot dummy(foo); 4770b1f6deSCorentin Jabot } 4870b1f6deSCorentin Jabot call()4970b1f6deSCorentin Jabotvoid call() { 5070b1f6deSCorentin Jabot g(0); //expected-note {{here}} 5170b1f6deSCorentin Jabot } 5270b1f6deSCorentin Jabot 5370b1f6deSCorentin Jabot } // namespace global 5470b1f6deSCorentin Jabot 5570b1f6deSCorentin Jabot namespace named { 5670b1f6deSCorentin Jabot 5770b1f6deSCorentin Jabot using std::forward; 5870b1f6deSCorentin Jabot using std::move; 5970b1f6deSCorentin Jabot f()6070b1f6deSCorentin Jabotvoid f() { 6170b1f6deSCorentin Jabot int i = 0; 62*f6a5ab6cSRichard Smith move(i); // expected-warning{{unqualified call to 'std::move}} 6370b1f6deSCorentin Jabot move(1, 2); 64*f6a5ab6cSRichard Smith forward<int>(i); // expected-warning{{unqualified call to 'std::forward}} 6570b1f6deSCorentin Jabot } 6670b1f6deSCorentin Jabot 6770b1f6deSCorentin Jabot template <typename T> g(T && foo)6870b1f6deSCorentin Jabotvoid g(T &&foo) { 69*f6a5ab6cSRichard Smith move(foo); // expected-warning{{unqualified call to 'std::move}} 70*f6a5ab6cSRichard Smith forward<decltype(foo)>(foo); // expected-warning{{unqualified call to 'std::forward}} 71*f6a5ab6cSRichard Smith (forward<decltype(foo)>)(foo); // expected-warning{{unqualified call to 'std::forward}} 7270b1f6deSCorentin Jabot move(1, 2); 7370b1f6deSCorentin Jabot } 7470b1f6deSCorentin Jabot call()7570b1f6deSCorentin Jabotvoid call() { 7670b1f6deSCorentin Jabot g(0); //expected-note {{here}} 7770b1f6deSCorentin Jabot } 7870b1f6deSCorentin Jabot 7970b1f6deSCorentin Jabot } // namespace named 8070b1f6deSCorentin Jabot 8170b1f6deSCorentin Jabot namespace overload { 8270b1f6deSCorentin Jabot using namespace std; 8370b1f6deSCorentin Jabot template <typename T> 8470b1f6deSCorentin Jabot int move(T &&); f()8570b1f6deSCorentin Jabotvoid f() { 8670b1f6deSCorentin Jabot int i = 0; 8770b1f6deSCorentin Jabot move(i); 8870b1f6deSCorentin Jabot } 8970b1f6deSCorentin Jabot } // namespace overload 9070b1f6deSCorentin Jabot 9170b1f6deSCorentin Jabot namespace adl { f()9270b1f6deSCorentin Jabotvoid f() { 93*f6a5ab6cSRichard Smith move(std::foo{}); // expected-warning{{unqualified call to 'std::move}} 9470b1f6deSCorentin Jabot } 9570b1f6deSCorentin Jabot 9670b1f6deSCorentin Jabot } // namespace adl 9770b1f6deSCorentin Jabot 9870b1f6deSCorentin Jabot namespace std { 9970b1f6deSCorentin Jabot f()10070b1f6deSCorentin Jabotvoid f() { 10170b1f6deSCorentin Jabot int i = 0; 102*f6a5ab6cSRichard Smith move(i); // expected-warning{{unqualified call to 'std::move}} 103*f6a5ab6cSRichard Smith forward<int>(i); // expected-warning{{unqualified call to 'std::forward}} 10470b1f6deSCorentin Jabot } 10570b1f6deSCorentin Jabot 10670b1f6deSCorentin Jabot } // namespace std 10770b1f6deSCorentin Jabot 10870b1f6deSCorentin Jabot namespace test_alias { 10970b1f6deSCorentin Jabot namespace alias = std; 11070b1f6deSCorentin Jabot using namespace alias; f()11170b1f6deSCorentin Jabotvoid f() { 11270b1f6deSCorentin Jabot int i = 0; 113*f6a5ab6cSRichard Smith move(i); // expected-warning{{unqualified call to 'std::move}} 11470b1f6deSCorentin Jabot move(1, 2); 115*f6a5ab6cSRichard Smith forward<int>(i); // expected-warning{{unqualified call to 'std::forward}} 11670b1f6deSCorentin Jabot } 11770b1f6deSCorentin Jabot 11870b1f6deSCorentin Jabot } // namespace test_alias 119