From: Douglas Gregor Date: Fri, 21 Jan 2011 05:24:25 +0000 (+0000) Subject: More testing to C++0x [temp.deduct.call]p3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd0e023cf8faf95eb8025a02ce6fd19ef7788216;p=clang More testing to C++0x [temp.deduct.call]p3 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123967 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp index 87fa907636..05d9b328a3 100644 --- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp @@ -22,3 +22,25 @@ void test_f0() { X xy1 = f0(xvalue()); X xy2 = f0(lvalue()); } + +template X f1(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'int const &&' for 1st argument}} \ +// expected-note{{candidate function [with T = Y] not viable: no known conversion from 'Y' to 'Y const &&' for 1st argument}} + +void test_f1() { + X xi0 = f1(prvalue()); + X xi1 = f1(xvalue()); + f1(lvalue()); // expected-error{{no matching function for call to 'f1'}} + X xy0 = f1(prvalue()); + X xy1 = f1(xvalue()); + f1(lvalue()); // expected-error{{no matching function for call to 'f1'}} +} + +namespace std_example { + template int f(T&&); + template int g(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'int const &&' for 1st argument}} + + int i; + int n1 = f(i); + int n2 = f(0); + int n3 = g(i); // expected-error{{no matching function for call to 'g'}} +}