[llvm-bugs] [Bug 27962] New: Cannot parse array subscript with comma/assignment
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jun 1 04:45:55 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27962
Bug ID: 27962
Summary: Cannot parse array subscript with comma/assignment
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: hstong at ca.ibm.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Clang fails to attempt parsing a /statement/ as an /expression-statement/ when
it encounters a comma (or an assignment operator) in the potential array bound
in its attempt to parse the /statement/ as a /declaration-statement/.
### SOURCE:
void foo(int *x, unsigned idx) {
int(x[0, idx]);
}
### INVOCATION:
clang++ -cc1 -fsyntax-only subscriptvex.cc
### ACTUAL OUTPUT:
subscriptvex.cc:2:11: error: expected ']'
int(x[0, idx]);
^
subscriptvex.cc:2:9: note: to match this '['
int(x[0, idx]);
^
subscriptvex.cc:2:8: error: redefinition of 'x' with a different type: 'int
([0]' vs 'int *'
int(x[0, idx]);
^
subscriptvex.cc:1:15: note: previous definition is here
void foo(int *x, unsigned idx) {
^
2 errors generated.
### EXPECTED OUTPUT:
Clean compile.
--
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/20160601/cb329cf1/attachment-0001.html>
More information about the llvm-bugs
mailing list