[llvm-bugs] [Bug 36762] New: -Wunused-private-field behavior depends on copy constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 15 16:27:54 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36762

            Bug ID: 36762
           Summary: -Wunused-private-field behavior depends on copy
                    constructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugene.zelenko at gmail.com
                CC: llvm-bugs at lists.llvm.org

I noticed difference in -Wunused-private-field behavior while cleaning
include/clang/Analysis/Analyses/ThreadSafetyTIL.h: warning is shown with
default copy constuctor, but not shown with custom copy constructor, same as
default:

/// Placeholder for expressions that cannot be represented in the TIL.
class Undefined : public SExpr {
public:
  Undefined(const Stmt *S = nullptr) : SExpr(COP_Undefined), Cstmt(S) {}
  Undefined(const Undefined &) = default; // <- warning
  Undefined(const Undefined &U) : SExpr(U), Cstmt(U.Cstmt) {} // <- no warning

  static bool classof(const SExpr *E) { return E->opcode() == COP_Undefined; }

  template <class V>
  typename V::R_SExpr traverse(V &Vs, typename V::R_Ctx Ctx) {
    return Vs.reduceUndefined(*this);
  }

  template <class C>
  typename C::CType compare(const Undefined* E, C& Cmp) const {
    return Cmp.trueResult();
  }

private:
  const Stmt *Cstmt;
};

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180315/3672410e/attachment-0001.html>


More information about the llvm-bugs mailing list