zero9178 created this revision. zero9178 added a reviewer: clang-language-wg. Herald added a project: All. zero9178 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
DR: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1227 This DR has been implemented in Clang as far back as I could check. This patch simply adds a test and comment to mark it as complete. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D122682 Files: clang/test/CXX/drs/dr12xx.cpp clang/www/cxx_dr_status.html Index: clang/www/cxx_dr_status.html =================================================================== --- clang/www/cxx_dr_status.html +++ clang/www/cxx_dr_status.html @@ -7176,7 +7176,7 @@ <td><a href="https://wg21.link/cwg1227">1227</a></td> <td>CD3</td> <td>Mixing immediate and non-immediate contexts in deduction failure</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="1228"> <td><a href="https://wg21.link/cwg1228">1228</a></td> Index: clang/test/CXX/drs/dr12xx.cpp =================================================================== --- clang/test/CXX/drs/dr12xx.cpp +++ clang/test/CXX/drs/dr12xx.cpp @@ -27,6 +27,21 @@ #endif } +#if __cplusplus >= 201103L +namespace dr1227 { // dr1227: yes +template <class T> struct A { using X = typename T::X; }; // expected-error {{type 'int' cannot be used prior to '::' because it has no members}} +template <class T> typename T::X f(typename A<T>::X); +template <class T> void f(...) { } +template <class T> auto g(typename A<T>::X) -> typename T::X; // expected-note {{in instantiation of template class 'dr1227::A<int>' requested here}} +template <class T> void g(...) { } + +void h() { + f<int>(0); // OK, substituting return type causes deduction to fail + g<int>(0); // expected-note {{while substituting explicitly-specified template arguments into function template 'g'}} +} +} +#endif + namespace dr1250 { // dr1250: 3.9 struct Incomplete;
Index: clang/www/cxx_dr_status.html =================================================================== --- clang/www/cxx_dr_status.html +++ clang/www/cxx_dr_status.html @@ -7176,7 +7176,7 @@ <td><a href="https://wg21.link/cwg1227">1227</a></td> <td>CD3</td> <td>Mixing immediate and non-immediate contexts in deduction failure</td> - <td class="none" align="center">Unknown</td> + <td class="full" align="center">Yes</td> </tr> <tr id="1228"> <td><a href="https://wg21.link/cwg1228">1228</a></td> Index: clang/test/CXX/drs/dr12xx.cpp =================================================================== --- clang/test/CXX/drs/dr12xx.cpp +++ clang/test/CXX/drs/dr12xx.cpp @@ -27,6 +27,21 @@ #endif } +#if __cplusplus >= 201103L +namespace dr1227 { // dr1227: yes +template <class T> struct A { using X = typename T::X; }; // expected-error {{type 'int' cannot be used prior to '::' because it has no members}} +template <class T> typename T::X f(typename A<T>::X); +template <class T> void f(...) { } +template <class T> auto g(typename A<T>::X) -> typename T::X; // expected-note {{in instantiation of template class 'dr1227::A<int>' requested here}} +template <class T> void g(...) { } + +void h() { + f<int>(0); // OK, substituting return type causes deduction to fail + g<int>(0); // expected-note {{while substituting explicitly-specified template arguments into function template 'g'}} +} +} +#endif + namespace dr1250 { // dr1250: 3.9 struct Incomplete;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits