O
Old Wolf
g++ accepts this code:
struct S;
struct T {};
struct Foo
{
static S a[];
static T b[];
};
int main() {}
However, the following are all rejected:
namespace Bar
{
static S a[];
static T b[];
}
static S a[];
static T b[];
What's the rationale for accepting an incomplete array type as a
static struct member (and even an incomplete array of
incomplete types), but not at namespace scope?
Is this ever useful and/or should it ever actually be used?
Are there any other scenarios in C++ where an incomplete array
type can occur?
struct S;
struct T {};
struct Foo
{
static S a[];
static T b[];
};
int main() {}
However, the following are all rejected:
namespace Bar
{
static S a[];
static T b[];
}
static S a[];
static T b[];
What's the rationale for accepting an incomplete array type as a
static struct member (and even an incomplete array of
incomplete types), but not at namespace scope?
Is this ever useful and/or should it ever actually be used?
Are there any other scenarios in C++ where an incomplete array
type can occur?