[LLVMbugs] [Bug 8773] New: Poor diagnostics and error recovery for templated method call on mis-declared class member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 10 16:00:15 PST 2010


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

           Summary: Poor diagnostics and error recovery for templated
                    method call on mis-declared class member
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ cat ~/llvm/testcases/bad_templated_method_call.cc
class Bar;
class Baz {
  void f() {
    obj.method<Bar>();
  }
  Foo obj;
};
$ clang -fsyntax-only ~/llvm/testcases/bad_templated_method_call.cc 
/home/matthewbg/llvm/testcases/bad_templated_method_call.cc:6:3: error: unknown
      type name 'Foo'
  Foo obj;
  ^
/home/matthewbg/llvm/testcases/bad_templated_method_call.cc:4:16: error: 'Bar'
      does not refer to a value
    obj.method<Bar>();
               ^
/home/matthewbg/llvm/testcases/bad_templated_method_call.cc:1:7: note: declared
      here
class Bar;
      ^
/home/matthewbg/llvm/testcases/bad_templated_method_call.cc:4:21: error: 
      expected expression
    obj.method<Bar>();
                    ^
3 errors generated.

=====

Having "obj.method<Bar>();" parsed as an arithmetic expression is really
confusing. It would be nice if there were some better recovery here. Also, if
'obj' is a local instead of a class member, it incurs a "use of undeclared
identifier" error at the start of the method call statement, which helps point
out what's wrong.

-- 
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