diff --git a/clang/test/CXX/drs/dr6xx.cpp b/clang/test/CXX/drs/dr6xx.cpp index 74b9a546f623..9dfcc7d6b464 100644 --- a/clang/test/CXX/drs/dr6xx.cpp +++ b/clang/test/CXX/drs/dr6xx.cpp @@ -353,3 +353,66 @@ namespace dr639 { // dr639: yes void((i = 0) + (i = 0)); // expected-warning {{unsequenced}} } } + +namespace dr692 { // dr692: no + namespace temp_func_order_example2 { + template struct A {}; + template void f(U, A *p = 0); // expected-note {{candidate}} + template int &f(U, A *p = 0); // expected-note {{candidate}} + template void g(T, T = T()); + template void g(T, U...); // expected-error 0-1{{C++11}} + void h() { + int &r = f(42, (A *)0); + f(42); // expected-error {{ambiguous}} + // FIXME: We should reject this due to ambiguity between the pack and the + // default argument. Only parameters with arguments are considered during + // partial ordering of function templates. + g(42); + } + } + + namespace temp_func_order_example3 { + template void f(T, U...); // expected-error 0-1{{C++11}} + template void f(T); + template int &g(T *, U...); // expected-error 0-1{{C++11}} + template void g(T); + void h(int i) { + // This is made ambiguous by dr692, but made valid again by dr1395. + f(&i); + int &r = g(&i); + } + } + + namespace temp_deduct_partial_example { + template char &f(Args... args); // expected-error 0-1{{C++11}} + template short &f(T1 a1, Args... args); // expected-error 0-1{{C++11}} + template int &f(T1 a1, T2 a2); + void g() { + char &a = f(); + short &b = f(1, 2, 3); + int &c = f(1, 2); + } + } + + namespace temp_deduct_type_example1 { + template class S; // expected-error 0-1{{C++11}} + template class S; // expected-error 0-1{{C++11}} + template class S {}; + S s; + + // FIXME: This should select the first partial specialization. Deduction of + // the second from the first should succeed, because we should ignore the + // trailing pack in A with no corresponding P. + template struct A; // expected-error 0-1{{C++11}} + template struct A; // expected-note {{matches}} expected-error 0-1{{C++11}} + template struct A {}; // expected-note {{matches}} + template struct A; // expected-error {{ambiguous}} + } + + namespace temp_deduct_type_example3 { + // FIXME: This should select the first template, as in the case above. + template void f(T*, U...){} // expected-note {{candidate}} expected-error 0-1{{C++11}} + template void f(T){} // expected-note {{candidate}} + template void f(int*); // expected-error {{ambiguous}} + } +}