Date: Mon, 17 Feb 2025 23:09:08 +0300
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?
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
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?
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
Received on 2025-02-17 20:09:37