[LLVMbugs] [Bug 13653] New: Warn on self assignment with explicit cast

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 20 14:34:14 PDT 2012


             Bug #: 13653
           Summary: Warn on self assignment with explicit cast
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dblaikie at gmail.com
                CC: dgregor at apple.com, echristo at gmail.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang should warn on:

  struct foo { ... };
  foo f;
  f = foo(f);

because echristo made this mistake once.

We currently only warn on self assignment of builtin types (int, etc), not user
defined types (presumably because they might have interesting/deliberate side
effects - though I haven't confirmed that this is the reason for the choice).
The case above may be sufficiently uncommon that the bug/non-bug ratio is high
enough to warn.

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