r255323 - Add some more tests for initializer lists related to CWG1591

Faisal Vali via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 17:04:30 PST 2015


Author: faisalv
Date: Thu Dec 10 19:04:30 2015
New Revision: 255323

URL: http://llvm.org/viewvc/llvm-project?rev=255323&view=rev
Log:
Add some more tests for initializer lists related to CWG1591

Modified:
    cfe/trunk/test/CXX/drs/dr15xx.cpp

Modified: cfe/trunk/test/CXX/drs/dr15xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr15xx.cpp?rev=255323&r1=255322&r2=255323&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr15xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr15xx.cpp Thu Dec 10 19:04:30 2015
@@ -150,6 +150,26 @@ namespace dr1591 {  //dr1591. Deducing a
     double *p = f({1, 2, 3});
     float *fp = f({{1}, {1, 2}, {1, 2, 3}});
   }
+  namespace core_reflector_28543 {
+    
+    template<class T, int N> int *f(T (&&)[N]);  // #1
+    template<class T> char *f(std::initializer_list<T> &&);  //#2
+    template<class T, int N, int M> int **f(T (&&)[N][M]); //#3 expected-note{{candidate}}
+    template<class T, int N> char **f(std::initializer_list<T> (&&)[N]); //#4 expected-note{{candidate}}
+
+    template<class T> short *f(T (&&)[2]);  //#5
+
+    template<class T> using Arr = T[];
+     
+    char *pc = f({1, 2, 3}); // OK prefer #2 via 13.3.3.2 [over.ics.rank]
+    char *pc2 = f({1, 2}); // #2 also 
+    int *pi = f(Arr<int>{1, 2, 3}); // OK prefer #1
+
+    void *pv1 = f({ {1, 2, 3}, {4, 5, 6} }); // expected-error{{ambiguous}} btw 3 & 4
+    char **pcc = f({ {1}, {2, 3} }); // OK #4
+
+    short *ps = f(Arr<int>{1, 2});  // OK #5
+  }
 } // dr1591
 
 #endif




More information about the cfe-commits mailing list