这两个说法在N4140中不是不兼容吗?
Aren't these two statements incompatible in N4140?
第 8.3.5/8 段(强调我的):
If the type of a parameter includes a type of the form “pointer to
array of unknown bound of T” or “reference to array of unknown bound
of T,” the program is ill-formed. Functions shall not have a return
type of type array or function, although they may have a return type
of type pointer or reference to such things. There shall be no arrays
of functions, although there can be arrays of pointers to functions.
§8.5.3/5 的要点 (5.2.1) 和 (5.2.1.1)(重点是我的):
(5.2.1) — If the initializer expression
(5.2.1.1) — is an xvalue (but not a bit-field), class prvalue,
array prvalue or function lvalue and “cv1 T1” is reference-compatible with “cv2 T2”, or
如果我的假设(在标题中)有误,我将不胜感激有一个生成纯右值数组的示例。
int main() {
using Arr = int[];
auto&& r = Arr{1, 2, 3, 4, 5};
return 0;
}
此处r
绑定到数组类型的纯右值。
第 8.3.5/8 段(强调我的):
If the type of a parameter includes a type of the form “pointer to array of unknown bound of T” or “reference to array of unknown bound of T,” the program is ill-formed. Functions shall not have a return type of type array or function, although they may have a return type of type pointer or reference to such things. There shall be no arrays of functions, although there can be arrays of pointers to functions.
§8.5.3/5 的要点 (5.2.1) 和 (5.2.1.1)(重点是我的):
(5.2.1) — If the initializer expression
(5.2.1.1) — is an xvalue (but not a bit-field), class prvalue, array prvalue or function lvalue and “cv1 T1” is reference-compatible with “cv2 T2”, or
如果我的假设(在标题中)有误,我将不胜感激有一个生成纯右值数组的示例。
int main() {
using Arr = int[];
auto&& r = Arr{1, 2, 3, 4, 5};
return 0;
}
此处r
绑定到数组类型的纯右值。