[cfe-commits] r123331 - /cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp

Douglas Gregor dgregor at apple.com
Wed Jan 12 14:04:05 PST 2011


Author: dgregor
Date: Wed Jan 12 16:04:05 2011
New Revision: 123331

URL: http://llvm.org/viewvc/llvm-project?rev=123331&view=rev
Log:
Add some more partial-ordering tests, including one that changes with
the proposed resolution to core isue 692. I'm not certain which way
we'll go on this one.

Modified:
    cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp

Modified: cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp?rev=123331&r1=123330&r2=123331&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp Wed Jan 12 16:04:05 2011
@@ -28,3 +28,36 @@
 int check2[X1<tuple<int, int>>::value == 1? 1 : -1];
 int check3[X1<tuple<int, int&>>::value == 2? 1 : -1];
 int check4[X1<tuple<int&, int&>>::value == 3? 1 : -1];
+
+// Partial ordering of function templates.
+template<typename T1, typename T2, typename ...Rest>
+int &f0(T1, T2, Rest...); // expected-note{{candidate function [with T1 = int, T2 = double, Rest = <>]}}
+
+template<typename T1, typename T2>
+float &f0(T1, T2); // expected-note{{candidate function [with T1 = int, T2 = double]}}
+
+// FIXME: this is currently ambiguous, based on the proposed resolution
+// to core issue 692.
+void test_f0() {
+  int &ir1 = f0(1, 2.0, 'a');
+  float &fr1 = f0(1, 2.0); // expected-error{{call to 'f0' is ambiguous}}
+}
+
+template<typename T1, typename T2, typename ...Rest>
+int &f1(T1, T2, Rest...);
+
+template<typename T1, typename T2>
+float &f1(T1, T2, ...);
+
+void test_f1() {
+  int &ir1 = f1(1, 2.0, 'a');
+}
+
+template<typename T1, typename T2, typename ...Rest>
+int &f2(T1, T2, Rest...);
+
+float &f2(...);
+
+void test_f2() {
+  int &ir1 = f2(1, 2.0, 'a');
+}





More information about the cfe-commits mailing list