Fznamznon added inline comments.
================ Comment at: clang/test/SemaCXX/paren-list-agg-init.cpp:276-285 +namespace gh62863 { +int (&&arr)[] = static_cast<int[]>(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} +int (&&arr1)[1] = static_cast<int[]>(42); +// beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} +int (&&arrr2)[2] = static_cast<int[]>(42); // expected-error {{reference to type 'int[2]' could not bind to an rvalue of type 'int[1]'}} +// beforecxx20-warning@-1 {{aggregate initialization of type 'int[1]' from a parenthesized list of values is a C++20 extension}} ---------------- aaron.ballman wrote: > I'd like to see test coverage for: > ``` > int (&&arr)[] = (int[])(42); > int (&&arr1)[1] = (int[])(42); > int (&&arrr2)[2] = (int[])(42); > int (&&arr3)[3] = (int[3])(42); > ``` > where we're using a C-style cast, because: http://eel.is/c++draft/expr.cast#4 Thank you for the review! Just to double check, so it says: > The conversions performed by ... *all named casts* can be performed using the > cast notation of explicit type conversion. Does that mean the c-style cast should produce the same thing? And, https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1975r0.html doesn't say anything about c-style casts because it is assumed that it should be able to do anything that `static_cast` can do? gcc doesn't agree https://godbolt.org/z/Pfq8frdn9 . The funny thing is that the original bug report seems to be using some kind of gcc test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152003/new/ https://reviews.llvm.org/D152003 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits