Date: Tue, 18 Feb 2025 17:25:16 +0300
Thanks, Andrew.
Could you provide a reference to the updated C++23 Standard Draft that contains such changes?
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
>Вторник, 18 февраля 2025, 8:43 +03:00 от Andrew Schepler via Std-Discussion <std-discussion_at_[hidden]>:
>
>This is exactly what was clarified by DR 2643: https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2643
>On Mon, Feb 17, 2025 at 4:17PM Andrey Semashev via Std-Discussion < std-discussion_at_[hidden] > wrote:
>>On 2/18/25 00:16, Andrey Semashev wrote:
>>> On 2/17/25 23:09, Vladimir Grigoriev via Std-Discussion wrote:
>>>> In p. 5 of the section 6.2 Declarations and definitions of the C++23
>>>> Standard there is written
>>>>
>>>> 5 In the definition of an object, the type of that object shall not be
>>>> an incomplete type (6.8), an abstract class type (11.7.4), or a
>>>> (possibly multi-dimensional) array thereof
>>>>
>>>> Also in p.5 of the sub-section 6.8.1 General of the section 6.8 Types
>>>> there is written
>>>>
>>>> ...The type of a pointer to array of unknown bound, or of a type defined
>>>> by a typedef declaration to be an array of unknown bound, cannot be
>>>> completed.
>>>>
>>>> And further there is followed an example (Example 3)
>>>>
>>>> class X; // X is an incomplete type
>>>> extern X* xp; // xp is a pointer to an incomplete type
>>>> extern int arr[]; // the type of arr is incomplete
>>>> typedef int UNKA[]; // UNKA is an incomplete type
>>>> UNKA* arrp; // arrp is a pointer to an incomplete type
>>>> UNKA** arrpp;
>>>>
>>>> But according to the first provided quote this object definition
>>>>
>>>> UNKA* arrp; // arrp is a pointer to an incomplete type
>>>>
>>>> is invalid because such a pointer has an incomplete type.
>>>>
>>>> So it looks like the example does not make sense or do I have missed
>>>> something?
>>>
>>> I'm not sure which version of the standard you're reading, but the
>>> current wording is different. I'm guessing you're referring to Note 2 in
>>> paragraph 6:
>>
>>I meant Note 3, sorry for the typo.
>>
>>> http://eel.is/c++draft/basic.types.general#6
>>>
>>> <quote>
>>> The type of a pointer or reference to array of unknown bound permanently
>>> points to or refers to an incomplete type.
>>> An array of unknown bound named by a typedef declaration permanently
>>> refers to an incomplete type.
>>> In either case, the array type cannot be completed.
>>> </quote>
>>>
>>> Note the text refers to the *array* type, not the *pointer* type. The
>>> pointer type itself is always complete, even if the pointee type is
>>> incomplete.
>>>
>>
>>--
>>Std-Discussion mailing list
>>Std-Discussion_at_[hidden]
>>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>--
>Std-Discussion mailing list
>Std-Discussion_at_lists.isocpp.org
>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
Could you provide a reference to the updated C++23 Standard Draft that contains such changes?
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
>Вторник, 18 февраля 2025, 8:43 +03:00 от Andrew Schepler via Std-Discussion <std-discussion_at_[hidden]>:
>
>This is exactly what was clarified by DR 2643: https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2643
>On Mon, Feb 17, 2025 at 4:17PM Andrey Semashev via Std-Discussion < std-discussion_at_[hidden] > wrote:
>>On 2/18/25 00:16, Andrey Semashev wrote:
>>> On 2/17/25 23:09, Vladimir Grigoriev via Std-Discussion wrote:
>>>> In p. 5 of the section 6.2 Declarations and definitions of the C++23
>>>> Standard there is written
>>>>
>>>> 5 In the definition of an object, the type of that object shall not be
>>>> an incomplete type (6.8), an abstract class type (11.7.4), or a
>>>> (possibly multi-dimensional) array thereof
>>>>
>>>> Also in p.5 of the sub-section 6.8.1 General of the section 6.8 Types
>>>> there is written
>>>>
>>>> ...The type of a pointer to array of unknown bound, or of a type defined
>>>> by a typedef declaration to be an array of unknown bound, cannot be
>>>> completed.
>>>>
>>>> And further there is followed an example (Example 3)
>>>>
>>>> class X; // X is an incomplete type
>>>> extern X* xp; // xp is a pointer to an incomplete type
>>>> extern int arr[]; // the type of arr is incomplete
>>>> typedef int UNKA[]; // UNKA is an incomplete type
>>>> UNKA* arrp; // arrp is a pointer to an incomplete type
>>>> UNKA** arrpp;
>>>>
>>>> But according to the first provided quote this object definition
>>>>
>>>> UNKA* arrp; // arrp is a pointer to an incomplete type
>>>>
>>>> is invalid because such a pointer has an incomplete type.
>>>>
>>>> So it looks like the example does not make sense or do I have missed
>>>> something?
>>>
>>> I'm not sure which version of the standard you're reading, but the
>>> current wording is different. I'm guessing you're referring to Note 2 in
>>> paragraph 6:
>>
>>I meant Note 3, sorry for the typo.
>>
>>> http://eel.is/c++draft/basic.types.general#6
>>>
>>> <quote>
>>> The type of a pointer or reference to array of unknown bound permanently
>>> points to or refers to an incomplete type.
>>> An array of unknown bound named by a typedef declaration permanently
>>> refers to an incomplete type.
>>> In either case, the array type cannot be completed.
>>> </quote>
>>>
>>> Note the text refers to the *array* type, not the *pointer* type. The
>>> pointer type itself is always complete, even if the pointee type is
>>> incomplete.
>>>
>>
>>--
>>Std-Discussion mailing list
>>Std-Discussion_at_[hidden]
>>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>--
>Std-Discussion mailing list
>Std-Discussion_at_lists.isocpp.org
>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
Received on 2025-02-18 14:25:44