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

           Summary: clang could help more when calling pointer-to-member
                    function
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


This invalid program gives a diagnostic that could be better:

  struct X { void foo(); };
  void t() {
    X x;
    void (X::*y)() = &X::foo;
    x.*y();
  }

These member-pointer things are hard (though fortunately rare), so a good
compiler diagnostic would be really helpful. The error is:

x.cc:6:7: error: called object type 'void (X::*)()' is not a function or
      function pointer
  x.*y();
     ~^

while gcc gives me this:

x.cc: In function ‘void t()’:
x.cc:6: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘y
(...)’, e.g. ‘(... ->* y) (...)’

which actually showed me that I needed to insert the parens. Nice.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to