[PATCH] D156032: Implement CWG2137 (list-initialization from objects of the same type)

Mital Ashok via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 13:06:53 PDT 2023


MitalAshok marked 2 inline comments as done and an inline comment as not done.
MitalAshok added a comment.

It seems there were two places which relied on `T x = { xvalue_of_type_T }` being a copy-initialization: The test at https://reviews.llvm.org/D156032#inline-1509544 and that one pair constructor test.

GCC seems to allow it but I don't think that's standard. I also have a pretty short patch to implement this behaviour if we decide that it needs to be supported (maybe this is a standard defect?)



================
Comment at: clang/test/CXX/drs/dr23xx.cpp:9
+namespace std {
+  __extension__ typedef __SIZE_TYPE__ size_t;
+
----------------
cor3ntin wrote:
> 
Wouldn't work in c++98 mode this file is being run in. I've copied this from other tests in this directory. I guess I can put a `#if __cplusplus >= 201103L` instead?


================
Comment at: clang/test/CXX/drs/dr23xx.cpp:50
 
+namespace dr2311 {
+#if __cplusplus >= 201707L
----------------
cor3ntin wrote:
> the dr status html page is generated automatically by leaving a magic comment here - and then running `clang/www/make_cxx_dr_status`
CWG2311 is still open, but clang did support list-initialization elision before this patch. The committee still needs to decide how exactly this elision is going to work, which might be different from how this patch implements it, so hesitant to mark this as done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156032



More information about the cfe-commits mailing list