[PATCH] D151634: [clang] Add test for CWG253

Vlad Serebrennikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 28 13:07:06 PDT 2023


Endill created this revision.
Endill added reviewers: clang-language-wg, shafik.
Herald added a project: All.
Endill requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also mark CWG78 as "no". CWG253 is the only issue that references 78, and they reference the same paragraph, so I guess that's the issue Richard thought that supersedes 78.

I think they are different, though: 78 is concerned about initialization of static objectы when no initializer is specified, whereas 253 is concerned with users required to explicitly declare defaulted default constructor when they want to declare local object without initializer, when there's nothing to initialize (e.g. a struct without non-static data members).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151634

Files:
  clang/test/CXX/drs/dr0xx.cpp
  clang/test/CXX/drs/dr2xx.cpp


Index: clang/test/CXX/drs/dr2xx.cpp
===================================================================
--- clang/test/CXX/drs/dr2xx.cpp
+++ clang/test/CXX/drs/dr2xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -682,6 +683,17 @@
   G::~G() {}
 }
 
+namespace dr253 { // dr253: 3.9
+struct Z {
+  operator int() const { return 0; }
+};
+
+void f() {
+  const Z z1;      
+  const Z z2 = { };
+}
+} // namespace dr253
+
 namespace dr254 { // dr254: yes
   template<typename T> struct A {
     typedef typename T::type type; // ok even if this is a typedef-name, because
Index: clang/test/CXX/drs/dr0xx.cpp
===================================================================
--- clang/test/CXX/drs/dr0xx.cpp
+++ clang/test/CXX/drs/dr0xx.cpp
@@ -4,6 +4,7 @@
 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++2b %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -1018,7 +1019,7 @@
   };
 }
 
-namespace dr78 { // dr78: sup ????
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
   // zero-initialized.
   const int k; // expected-error {{default initialization of an object of const}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151634.526341.patch
Type: text/x-patch
Size: 2040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230528/34408312/attachment-0001.bin>


More information about the cfe-commits mailing list