[cfe-dev] array has incomplete element type

Frank Redeker via cfe-dev cfe-dev at lists.llvm.org
Mon Jun 17 05:03:30 PDT 2019


Hello, List,

I'm using CLANG (6.0) to analyze C-Code that is written for a Windriver
Compiler.
Given the following piece of code.

extern const struct STRUCT Array[];

typedef struct STRUCT {
	int	Member;
} STRUCT;


int Foo (int i) {
	return Array[i].Member;
}

The Windriver compiler compiles this code without any problem (Does the
Windriver compiler violate an ANSI rule?). Buy when compiling which
clang it get
[error: array has incomplete element type 'const struct STRUCT']

(When compiling with clang++ the error goes away)

So my question is. Is there an option to handle the extern array in C
like in C++.


Frank



More information about the cfe-dev mailing list