------- Comment #2 from manu at gcc dot gnu dot org 2009-08-05 10:16 ------- At the moment the parser detects and reports the error, it doesn't know that it is parsing an array subscript. We could test for typical errors before trying to parse the expression but that would pessimize valid code. I am not sure what is the best approach in this case.
If no expression is found, no error is reported but an empty expression is returned, we could test that and give an appropriate error. Otherwise, we need to propagate the context to the point where the error is reported. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39858