https://github.com/Endilll updated https://github.com/llvm/llvm-project/pull/93708
>From 210d58b7133aeb007d423464bcd40d016fc25863 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov <serebrennikov.vladis...@gmail.com> Date: Wed, 29 May 2024 15:57:30 +0300 Subject: [PATCH] [clang] Add another test case for CWG78 --- clang/test/CXX/drs/cwg0xx.cpp | 8 +------- clang/test/CXX/drs/cwg78.cpp | 34 ++++++++++++++++++++++++++++++++++ clang/www/cxx_dr_status.html | 2 +- 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 clang/test/CXX/drs/cwg78.cpp diff --git a/clang/test/CXX/drs/cwg0xx.cpp b/clang/test/CXX/drs/cwg0xx.cpp index 6c600bbc7c3f6..abfaca7fe06e7 100644 --- a/clang/test/CXX/drs/cwg0xx.cpp +++ b/clang/test/CXX/drs/cwg0xx.cpp @@ -1180,13 +1180,7 @@ namespace cwg77 { // cwg77: yes }; } -namespace cwg78 { // cwg78: sup ???? - // Under CWG78, this is valid, because 'k' has static storage duration, so is - // zero-initialized. - const int k; - // expected-error@-1 {{default initialization of an object of const type 'const int'}} -} - +// cwg78 is in cwg78.cpp // cwg79: na namespace cwg80 { // cwg80: 2.9 diff --git a/clang/test/CXX/drs/cwg78.cpp b/clang/test/CXX/drs/cwg78.cpp new file mode 100644 index 0000000000000..e0c3b72c537cf --- /dev/null +++ b/clang/test/CXX/drs/cwg78.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++98 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++11 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++14 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++17 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++20 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++23 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++23 %s -verify -DVERIFY -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple + +// RUN: %clang_cc1 -std=c++98 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++11 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++14 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++17 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++20 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++23 %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK +// RUN: %clang_cc1 -std=c++2c %s -triple %itanium_abi_triple -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK + +namespace cwg78 { // cwg78: partial +// Under CWG78, this is valid, because 'k' has static storage duration, so is +// zero-initialized. +#ifdef VERIFY +const int k; +// expected-error@-1 {{default initialization of an object of const type 'const int'}} +#endif + +int f() { + static int i; + return i; +} + +// Checking that static variable is zero-initialized, +// and not default-initialized (which means no initialization in this case). + +// CHECK: @cwg78::f()::i = {{.*}} i32 0 +} // namespace cwg78 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html index 4cce88fe0490f..ff50a11c3f525 100755 --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -506,7 +506,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2> <td><a href="https://cplusplus.github.io/CWG/issues/78.html">78</a></td> <td>CD1</td> <td>Section 8.5 paragraph 9 should state it only applies to non-static objects</td> - <td class="none" align="center">Superseded by <a href="#????">????</a></td> + <td class="partial" align="center">Partial</td> </tr> <tr id="79"> <td><a href="https://cplusplus.github.io/CWG/issues/79.html">79</a></td> _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits