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

Vlad Serebrennikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 08:26:35 PDT 2023


Endill added inline comments.


================
Comment at: clang/test/CXX/drs/dr0xx.cpp:1022
 
-namespace dr78 { // dr78: sup ????
+namespace dr78 { // dr78: no
   // Under DR78, this is valid, because 'k' has static storage duration, so is
----------------
shafik wrote:
> Endill wrote:
> > shafik wrote:
> > > shafik wrote:
> > > > This is [issue 1380](https://github.com/cplusplus/papers/issues/1380) and the issue is whether we want static initialization to happen before constant initialization or whether constant initialization excludes zero-init. 
> > > > 
> > > > I think dr77 is now part of [cwg 2536](https://cplusplus.github.io/CWG/issues/2536.html) and we need to wait for the resolution of that in order to know what to do here. 
> > > I was mistaken and completely missed: https://eel.is/c++draft/dcl.init#general-8.sentence-2
> > > 
> > > DR 78 is just repeating what we have in: https://eel.is/c++draft/basic.start#static
> > > 
> > > The wording has changed a lot since DR 78.
> > Can you please elaborate how does your conclusion affect this patch? Because I feel a bit lost at this point.
> > Was my initial analysis correct, and we should say that this DR is not available in Clang?
> No, so this DR was just clarifying that static objects will not have an indeterminate value if they don't have an initializer. So we can consider this NA or you can add a test with a static global w/o an init and show it has zero value.
I'd like to focus on the following points:
1) test case is correct, because we're not supposed to issue a diagnostics for static objects without initializers
2) when we stop issuing a diagnostics, we should write a codegen test that ensures `k` is initialized with 0
3) this DR is not superseded, so we should mark it as `no`

Do you agree with everything above?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151634/new/

https://reviews.llvm.org/D151634



More information about the cfe-commits mailing list