llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Vlad Serebrennikov (Endilll) <details> <summary>Changes</summary> This PR adds tests for [CWG1670](https://cplusplus.github.io/CWG/issues/1670.html) "`auto` as _conversion-type-id_" and [CWG1878](https://cplusplus.github.io/CWG/issues/1878.html) "`operator auto` template". The long and short of it is that placeholder type specifier (`auto`) cannot be used to declare conversion function or conversion function template. We've always diagnosed template case but not non-template case. --- Full diff: https://github.com/llvm/llvm-project/pull/187850.diff 3 Files Affected: - (modified) clang/test/CXX/drs/cwg16xx.cpp (+9) - (modified) clang/test/CXX/drs/cwg18xx.cpp (+12-1) - (modified) clang/www/cxx_dr_status.html (+2-2) ``````````diff diff --git a/clang/test/CXX/drs/cwg16xx.cpp b/clang/test/CXX/drs/cwg16xx.cpp index 673916ee40d6f..bcae9e0b6d177 100644 --- a/clang/test/CXX/drs/cwg16xx.cpp +++ b/clang/test/CXX/drs/cwg16xx.cpp @@ -328,6 +328,15 @@ namespace cwg1658 { // cwg1658: 5 // assignment case is superseded by cwg2180 } // namespace cwg1658 +namespace cwg1670 { // cwg1670: no +#if __cpusplus >= 201103L +struct S { + operator auto() { return 0; } + // FIXME-error@-1 {{'auto' not allowed in declaration of conversion function}} +}; +#endif +} // namespace cwg1670 + namespace cwg1672 { // cwg1672: 7 struct Empty {}; struct A : Empty {}; diff --git a/clang/test/CXX/drs/cwg18xx.cpp b/clang/test/CXX/drs/cwg18xx.cpp index ebee9bc4c3e16..f0424a1021abc 100644 --- a/clang/test/CXX/drs/cwg18xx.cpp +++ b/clang/test/CXX/drs/cwg18xx.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx98-14,cxx98 -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx11-20,cxx98-14,cxx11-17,since-cxx11 +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx11-20,cxx98-14,cxx11-17,since-cxx11,cxx11 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx11-20,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx11-20,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -fexceptions -fcxx-exceptions -pedantic-errors -verify-directives -verify=expected,cxx11-20,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 @@ -467,6 +467,17 @@ template<int U> int A<int>::i() { (void)c.private_int; } } // namespace cwg1862 +namespace cwg1870 { // cwg1870: 2.7 +#if __cplusplus >= 201103L +struct S { + // FIXME: why C++11 has its own diagnostic message? + template<class T> operator auto() { return 42; } + // cxx11-error@-1 {{'auto' not allowed in conversion function type}} + // since-cxx14-error@-2 {{'auto' not allowed in declaration of conversion function template}} +}; +#endif +} // namespace cwg1870 + namespace cwg1872 { // cwg1872: 9 #if __cplusplus >= 201103L template<typename T> struct A : T { diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index cb0236b46e580..347f48ed7d87f 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -11475,7 +11475,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td>[<a href="https://wg21.link/dcl.spec.auto">dcl.spec.auto</a>]</td> <td>DR</td> <td><TT>auto</TT> as <I>conversion-type-id</I></td> - <td class="unknown" align="center">Unknown</td> + <td class="none" align="center">No</td> </tr> <tr id="1671"> <td><a href="https://cplusplus.github.io/CWG/issues/1671.html">1671</a></td> @@ -12875,7 +12875,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td>[<a href="https://wg21.link/basic.def">basic.def</a>]</td> <td>CD4</td> <td>Contradictory wording about definitions vs explicit specialization/instantiation</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 2.7</td> </tr> <tr id="1871"> <td><a href="https://cplusplus.github.io/CWG/issues/1871.html">1871</a></td> `````````` </details> https://github.com/llvm/llvm-project/pull/187850 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
