https://bugs.llvm.org/show_bug.cgi?id=41514
Bug ID: 41514
Summary: [Parser] Pragma inside statement causes error
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
The following source does not compile:
int main() {
return
#pragma STDC FENV_ACCESS OFF
0;
}
$ clang test.c
test.c:5:14: error: expected expression
#pragma STDC FENV_ACCESS OFF
^
1 error generated.
While this one does:
int main() {
#pragma STDC FENV_ACCESS OFF
return 0;
}
$ clang test.c
The reason is that the #pragma inserts an annotation token into the
preprocessor's token stream. This annotation is only handled before a new
statement is expected (method
Parser::ParseStatementOrDeclarationAfterAttributes), but not within e.g.
expressions.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs