Clang error: 'A' declared as array of functions of type B (err_illegal_decl_array_of_functions)
Jump to navigation
Jump to search
Text | error: 'A' declared as array of functions of type B |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_illegal_decl_array_of_functions |
Internal Message | '%0' declared as array of functions of type %1
|
Regular Expression | (?:error|fatal error)\: '(.*?)' declared as array of functions of type (.*?)
|
First Commit | 2009-03-14 5a8987ca5113 Update tablegen diagnostic files to be in sync with the def files. |
Description
Example
Flags | -xc++
|
|
---|---|---|
Source |
int main() { int a[10](); } // a is incorrectly declared as an array of functions returning int
| |
Compiler Output |
<source>:1:19: error: 'a' declared as array of functions of type 'int ()' |
Clang Internals (17.0.6)
Git Commit Message
Update tablegen diagnostic files to be in sync with the def files. llvm-svn: 67004
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaType.cpp (line 2530)
/// Build an array type.
///
/// \param T The type of each element in the array.
///
/// \param ASM C99 array size modifier (e.g., '*', 'static').
///
/// \param ArraySize Expression describing the size of the array.
///
/// \param Brackets The range from the opening '[' to the closing ']'.
///
/// \param Entity The name of the entity that involves the array
/// type, if known.
///
/// \returns A suitable array type, if there are no errors. Otherwise,
/// returns a NULL type.
QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity) {
// ...
if (T->isFunctionType()) {
Diag(Loc, diag::err_illegal_decl_array_of_functions) << getPrintableNameForEntity(Entity) << T;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Sema/static-array.c
- clang/test/Sema/static-array.c:60:14: error: 'x' declared as array of functions of type 'int (void)'