Mordante added inline comments.

================
Comment at: clang/test/CXX/drs/dr14xx.cpp:411-414
+  void f(const char[4]);
+  void f(const wchar_t[4]);
+  void f(const char16_t[4]);
+  void f(const char32_t[4]);
----------------
rsmith wrote:
> These should presumably be references to arrays, rather than arrays, or the 
> parameter type is as if you wrote (for example) `void f(const char *)`, which 
> shouldn't get the special treatment here.
> 
> [over.ics.list]p4 mentions this in its footnote:
> 
> "Otherwise, if the parameter type is a character array [Footnote: Since there 
> are no parameters of array type, this will only occur as the referenced type 
> of a reference parameter.] and the initializer list has a single element that 
> is an appropriately-typed string-literal (9.4.3), the implicit conversion 
> sequence is the identity conversion."
Ah I missed that footnote. I reread the standard and can you confirm some cases?
```
namespace A { 
  void f(const char(&)[4]);
  void g() { f({"abc"}); }
}
namespace B { 
  void f(const char(&&)[4]);
  void g() { f({"abc"}); }
} 
```
both should work and with P0388 the array without bounds will also work.

I ask since this is my interpretation of the standard, but it seems there's a 
difference between implementations and `void f(const char(&&)[4]);` fails for 
"abc" but works for "ab".
It seems ICC and consider "abc" an lvalue in this case and not when using "ab".

Here's a gotbolt link with the examples https://godbolt.org/z/r1TKfx


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87561

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to