llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Shengxin Pei (TPPPP72) <details> <summary>Changes</summary> Clang already supports CWG 2006. Adding test cases and updating `cxx_dr_status.html` to 3.0. Assisted by Claude. --- Full diff: https://github.com/llvm/llvm-project/pull/215259.diff 2 Files Affected: - (added) clang/test/CXX/drs/cwg2006.cpp (+100) - (modified) clang/www/cxx_dr_status.html (+1-1) ``````````diff diff --git a/clang/test/CXX/drs/cwg2006.cpp b/clang/test/CXX/drs/cwg2006.cpp new file mode 100644 index 0000000000000..c2bcd123db190 --- /dev/null +++ b/clang/test/CXX/drs/cwg2006.cpp @@ -0,0 +1,100 @@ +// RUN: %clang_cc1 -std=c++98 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,cxx98 +// RUN: %clang_cc1 -std=c++11 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,cxx11 +// RUN: %clang_cc1 -std=c++14 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,since-cxx14 +// RUN: %clang_cc1 -std=c++17 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,since-cxx14 +// RUN: %clang_cc1 -std=c++20 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,since-cxx14,since-cxx20 +// RUN: %clang_cc1 -std=c++23 %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,since-cxx14,since-cxx20 +// RUN: %clang_cc1 -std=c++2c %s -fexceptions -fcxx-exceptions -pedantic-errors -verify=expected,since-cxx11,since-cxx14,since-cxx20 +// expected-no-diagnostics + +namespace std { + class type_info; +} + +namespace cwg2006 { // cwg2006: 3.0 + void test_object_pointer(const void *cp, volatile void *vp, const volatile void *cvp) { + (void)static_cast<const void*>(cp); + (void)static_cast<volatile void*>(vp); + (void)static_cast<const volatile void*>(cvp); + + int x = 0; + const int cx = 0; + const void *p1 = &x; + const void *p2 = &cx; + (void)p1; + (void)p2; + } + + void test_cast(int x) { + (const void)x; + (volatile void)x; + (const volatile void)x; + } + + const void get_const_void() +#if __cplusplus >= 201103L + noexcept +#endif + {} + +#if __cplusplus >= 202002L +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-volatile" +#endif + + volatile void get_volatile_void() +#if __cplusplus >= 201103L + noexcept +#endif + {} + + const volatile void get_cv_void() +#if __cplusplus >= 201103L + noexcept +#endif + {} + +#if __cplusplus >= 202002L +#pragma clang diagnostic pop +#endif + + void test_return() { + return get_const_void(); + } + + void test_return_volatile() { + return get_volatile_void(); + } + + void test_return_cv() { + return get_cv_void(); + } + + void test_conditional(bool b) { + b ? get_const_void() : get_const_void(); + b ? get_volatile_void() : get_const_void(); + b ? get_cv_void() : get_const_void(); + } + + void test_typeid() { + (void)typeid(const void); + (void)typeid(volatile void); + (void)typeid(const volatile void); + } + +#if __cplusplus >= 201103L + template <typename T, typename U> + struct is_same { static constexpr bool value = false; }; + + template <typename T> + struct is_same<T, T> { static constexpr bool value = true; }; + + void test_cxx11() { + decltype(get_const_void()) *p = nullptr; + static_assert(noexcept(get_const_void()), ""); + + using CommonType = decltype(true ? get_const_void() : get_volatile_void()); + static_assert(is_same<CommonType, void>::value, ""); + } +#endif +} // namespace cwg2006 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 4d29e6b4b32f4..7d983650a82b8 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -13831,7 +13831,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td>[<a href="https://wg21.link/basic.compound">basic.compound</a>]</td> <td>CD4</td> <td>Cv-qualified <TT>void</TT> types</td> - <td class="unknown" align="center">Unknown</td> + <td class="full" align="center">Clang 3.0</td> </tr> <tr id="2007"> <td><a href="https://cplusplus.github.io/CWG/issues/2007.html">2007</a></td> `````````` </details> https://github.com/llvm/llvm-project/pull/215259 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
