From: Faisal Vali Date: Fri, 11 Dec 2015 01:04:30 +0000 (+0000) Subject: Add some more tests for initializer lists related to CWG1591 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da9fb58928568111371690f38c196f6710635b89;p=clang Add some more tests for initializer lists related to CWG1591 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255323 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/drs/dr15xx.cpp b/test/CXX/drs/dr15xx.cpp index 29887120c2..7472be72c2 100644 --- a/test/CXX/drs/dr15xx.cpp +++ b/test/CXX/drs/dr15xx.cpp @@ -150,6 +150,26 @@ namespace dr1591 { //dr1591. Deducing array bound and element type from initial double *p = f({1, 2, 3}); float *fp = f({{1}, {1, 2}, {1, 2, 3}}); } + namespace core_reflector_28543 { + + template int *f(T (&&)[N]); // #1 + template char *f(std::initializer_list &&); //#2 + template int **f(T (&&)[N][M]); //#3 expected-note{{candidate}} + template char **f(std::initializer_list (&&)[N]); //#4 expected-note{{candidate}} + + template short *f(T (&&)[2]); //#5 + + template 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{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{1, 2}); // OK #5 + } } // dr1591 #endif