[llvm-bugs] [Bug 34094] New: Artificial errors due to parser guessing

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 6 22:51:22 PDT 2017


            Bug ID: 34094
           Summary: Artificial errors due to parser guessing
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joriswu at gmail.com
                CC: llvm-bugs at lists.llvm.org

The frontend makes guesses at input errors, such as at missing declarations :

int my_scalars[100];

int foo(int x)
  my_scalar = 1;

// here we forgot to declare my_scalar as a plain int. First, the compiler
correctly emits :
error: use of undeclared 'my_scalar'; did you mean 'my_scalars' ?

But then the parser appears to actually insert the assumed array into the code,
and issues a false subsequent error that is misleading :

error: array type 'int [100]' is not assignable

I have seen more examples, where the 'guess' is actually used.

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/20170807/0a3f9d4e/attachment.html>

More information about the llvm-bugs mailing list