Clang error: extraneous 'A' before ';' (err_extraneous_token_before_semi)
Jump to navigation
Jump to search
Text | error: extraneous 'A' before ';' |
---|---|
Type | Error |
Category | Parse Issue |
Internal Id | err_extraneous_token_before_semi |
Internal Message | extraneous '%0' before ';'
|
Regular Expression | (?:error|fatal error)\: extraneous '(.*?)' before ';'
|
First Commit | 2010-09-07 45d6bdfa88d5 Improve recovery when there is a stray ']' or ')' before the ';' at |
Description
Example
Flags | -xc++
|
|
---|---|---|
Source |
// Extraneous ')' before ';'
int main() { int x = 0); return 0; }
| |
Compiler Output |
<source>:2:23: error: extraneous ')' before ';' |
Clang Internals (17.0.6)
Git Commit Message
Improve recovery when there is a stray ']' or ')' before the ';' at the end of a statement. Fixes <rdar://problem/6896493>. llvm-svn: 113202
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/Parse/Parser.cpp (line 168)
bool Parser::ExpectAndConsumeSemi(unsigned DiagID, StringRef TokenUsed) {
// ...
if ((Tok.is(tok::r_paren) || Tok.is(tok::r_square)) && NextToken().is(tok::semi)) {
Diag(Tok, diag::err_extraneous_token_before_semi) << PP.getSpelling(Tok) << FixItHint::CreateRemoval(Tok.getLocation());
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Parser/declarators.c
- clang/test/Parser/declarators.c:110:19: error: extraneous ')' before ';'