[llvm-bugs] [Bug 41514] New: [Parser] Pragma inside statement causes error
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 16 09:15:14 PDT 2019
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: unassignedclangbugs at nondot.org
Reporter: llvm at meinersbur.de
CC: hfinkel at anl.gov, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190416/9bf4b8c8/attachment-0001.html>
More information about the llvm-bugs
mailing list