[LLVMbugs] [Bug 13030] New: improve -> vs . typo correction for macro arguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 5 14:12:03 PDT 2012


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

             Bug #: 13030
           Summary: improve -> vs . typo correction for macro arguments
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On this code:

#define DO_IT(x) (x).fn();

struct S { int fn(); };

int f(S *p) {
  return DO_IT(p);
}

We produce this diagnostic:

<stdin>:6:10: error: member reference type 'S *' is a pointer; maybe you meant
to use '->'?
  return DO_IT(p);
         ^~~~~~~~
<stdin>:1:21: note: expanded from macro 'DO_IT'
#define DO_IT(x) (x).fn();
                 ~~~^

We could be more awesome than that, by pushing the typo correction out of
macros where possible:

<stdin>:6:10: error: member reference type 'S *' is a pointer; did you mean to
dereference it with '*'?
  return DO_IT(p);
               ^
               *
<stdin>:1:21: note: expanded from macro 'DO_IT'
#define DO_IT(x) (x).fn();
                 ~~~^

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