[LLVMbugs] [Bug 5864] New: poor error recovery for incorrect typename

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Dec 23 14:08:11 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=5864

           Summary: poor error recovery for incorrect typename
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu


Consider:
int foo(bar_t x) {
  return x+x;
}

in C mode, the parser thinks this might be a K&R identifier list and gets
confused:

t.c:2:15: error: expected ')'
int foo(bar_t x) {
              ^
t.c:2:8: note: to match this '('
int foo(bar_t x) {
       ^
t.c:3:10: error: use of undeclared identifier 'x'
  return x+x;
         ^

In C++ mode, we also don't recognize that it is a mistaken typename, but it
looks different somehow:

$ clang -xc++ t.c
t.c:2:9: error: use of undeclared identifier 'bar_t'
int foo(bar_t x) {
        ^
t.c:2:17: error: invalid token after top level declarator
int foo(bar_t x) {
                ^
                ;


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list