This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add test for CWG253
Needs ReviewPublic

Authored by Endill on May 28 2023, 1:07 PM.

Details

Reviewers
shafik
Group Reviewers
Restricted Project
Summary

Also mark CWG78 as superseded by CWG2536.

CWG253 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).

https://cplusplus.github.io/CWG/issues/253.html
https://cplusplus.github.io/CWG/issues/78.html

Diff Detail

Event Timeline

Endill created this revision.May 28 2023, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2023, 1:07 PM
Endill requested review of this revision.May 28 2023, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2023, 1:07 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Endill updated this revision to Diff 526342.May 28 2023, 1:09 PM

Update cxx_dr_status.html

shafik added inline comments.May 30 2023, 5:52 PM
clang/test/CXX/drs/dr0xx.cpp
1022

This is issue 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 and we need to wait for the resolution of that in order to know what to do here.

@shafik Thank you for letting me know! Now I wonder if it was possible to realize by myself without prior knowledge of CWG 2536, because I feel like some cross-references are missing.
Can we proceed if I strip CWG 78 out, leaving only CWG 253?

@shafik Thank you for letting me know! Now I wonder if it was possible to realize by myself without prior knowledge of CWG 2536, because I feel like some cross-references are missing.
Can we proceed if I strip CWG 78 out, leaving only CWG 253?

I don't think there was a way to figure this out w/o knowing or luck.

I think just leave out 78 for now.

clang/test/CXX/drs/dr2xx.cpp
686
Endill updated this revision to Diff 527804.Jun 2 2023, 4:41 AM
Endill edited the summary of this revision. (Show Details)

Mark CWG78 as superseded by 2536
Expand CWG253 test

@shafik I think rather than leave 78 out, we better mark it as superseded, so that we don't forget about it.

shafik added inline comments.Jun 2 2023, 10:14 AM
clang/test/CXX/drs/dr0xx.cpp
1022

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.

Endill added inline comments.Jun 2 2023, 10:43 AM
clang/test/CXX/drs/dr0xx.cpp
1022

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?

shafik added inline comments.Jun 8 2023, 8:08 PM
clang/test/CXX/drs/dr0xx.cpp
1022

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.

Endill added inline comments.Jun 24 2023, 11:16 PM
clang/test/CXX/drs/dr0xx.cpp
1022

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?