[LLVMbugs] [Bug 13520] New: -Wunused-private-field false positive after error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 2 18:41:37 PDT 2012


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

             Bug #: 13520
           Summary: -Wunused-private-field false positive after error
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: djasper at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This code triggers a -Wunused-private-field false positive on C::S::k:

class C {
  struct X {
    int n;
  } x;

public:
  class S {
  private:
    int k;
    C *p;
  public:
    S(int k, C *p) : k(k), p(p) {}
    void f() { p->x.n = k; }
  };

  void f(UnknownTypeName utn);
};

I guess we're setting C to be invalid, and so discarding the use of 'k' within
C::S::f.

(To see this in the wild, introduce a bad type name into any Sema member
function declaration...)

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