]> granicus.if.org Git - clang/commitdiff
More testing to C++0x [temp.deduct.call]p3
authorDouglas Gregor <dgregor@apple.com>
Fri, 21 Jan 2011 05:24:25 +0000 (05:24 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 21 Jan 2011 05:24:25 +0000 (05:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123967 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp

index 87fa907636b7bc7c00cab526d1d58095bc2229bb..05d9b328a36339c276c4d0db024c7c9df6df7e2a 100644 (file)
@@ -22,3 +22,25 @@ void test_f0() {
   X<Y> xy1 = f0(xvalue<Y>());
   X<Y&> xy2 = f0(lvalue<Y>());
 }
+
+template<typename T> X<T> 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<int> xi0 = f1(prvalue<int>());
+  X<int> xi1 = f1(xvalue<int>());
+  f1(lvalue<int>()); // expected-error{{no matching function for call to 'f1'}}
+  X<Y> xy0 = f1(prvalue<Y>());
+  X<Y> xy1 = f1(xvalue<Y>());
+  f1(lvalue<Y>()); // expected-error{{no matching function for call to 'f1'}}
+}
+
+namespace std_example {
+  template <class T> int f(T&&); 
+  template <class T> 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'}}
+}