Clang warning: tentative array definition assumed to have one element (warn_tentative_incomplete_array)
		
		
		
		
		
		Jump to navigation
		Jump to search
		
		
	
| Text | error: tentative array definition assumed to have one element | 
|---|---|
| Type | Warning | 
| Category | Semantic Issue | 
| Internal Id | warn_tentative_incomplete_array | 
| Active by Default | Yes | 
| Internal Message | tentative array definition assumed to have one element
 | 
| Regular Expression | (?:warning|error|fatal error)\: tentative array definition assumed to have one element(?: \[(?:\-Werror)?[^\]]*\])?
 | 
| First Commit | 2009-04-15 c7ba5333782f Add warning when a tentative array definition is assumed to have one element. | 
Description
Example
| Flags | -xc
 | 
|
|---|---|---|
| Source | 
int a[]; // Unspecified array size
int main() { return 0; }
 | |
| Compiler Output | 
<source>:1:5: warning: tentative array definition assumed to have one element  | 
Clang Internals (17.0.6)
Git Commit Message
Add warning when a tentative array definition is assumed to have one element. - Also, fixed one to actually be one (instead of zero). :) llvm-svn: 69226
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/Sema.cpp (line 1307)
/// ActOnEndOfTranslationUnit - This is called at the very end of the
/// translation unit when EOF is reached and all but the top-level scope is
/// popped.
void Sema::ActOnEndOfTranslationUnit() {
  // ...
  for (TentativeDefinitionsType::iterator T = TentativeDefinitions.begin(ExternalSource.get()), TEnd = TentativeDefinitions.end(); T != TEnd; ++T) {
    // ...
    if (const IncompleteArrayType *ArrayT = Context.getAsIncompleteArrayType(VD->getType())) {
      // ...
      Diag(VD->getLocation(), diag::warn_tentative_incomplete_array);
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Sema/extern-redecl.c
- clang/test/Sema/extern-redecl.c:4:12: warning: tentative array definition assumed to have one element
 
- clang/test/Sema/extern-redecl.c:23:12: warning: tentative array definition assumed to have one element