c-report-syntactic-errors

c-report-syntactic-errors is a variable defined in `cc-vars.el'.
Its value is
nil


Documentation:
*If non-nil, certain syntactic errors are reported with a ding
and a message, for example when an "else" is indented for which
there's no corresponding "if".

Note however that CC Mode doesn't make any special effort to check for
syntactic errors; that's the job of the compiler. The reason it can
report cases like the one above is that it can't find the correct
anchoring position to indent the line in that case.

You can customize this variable.