[llvm-bugs] [Bug 28576] New: please warn on side-effects in default arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 15 13:57:30 PDT 2016


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

            Bug ID: 28576
           Summary: please warn on side-effects in default arguments
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This sort of thing is pretty alarming:
  int counter = 0;
  void f(int n = counter++);
and should probably get a warning. The author could've put written 'counter++'
in the body of the function instead.

There may be legitimate cases where the value is a function call (ie., int n =
get_the_default()'), so probably suppress on those.

-- 
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/20160715/11bb8983/attachment.html>


More information about the llvm-bugs mailing list