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

            Bug ID: 43667
           Summary: Wshadow-field-in-constructor warning is not enabled by
                    corresponding command line option
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: l...@mrks.info
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Created attachment 22668
  --> https://bugs.llvm.org/attachment.cgi?id=22668&action=edit
test case

The attached test case should produce a warning saying that the `v` constructor
argument shadows the `v` class member. With -Wshadow-all, this happens as
expected:

    <source>:5:24: error: constructor parameter 'v' shadows the field 'v' of
'S' [-Werror,-Wshadow-field-in-constructor]
        S(std::vector<int> v) : v(std::move(v)) {
                           ^

    <source>:8:22: note: previous declaration is here
        std::vector<int> v;
                         ^

However, the warning / error is described to be coming from
-Wshadow-field-in-constructor. Accordingly, I would expect that flag alone to
be sufficient to turn on the warning. However, when replacing -Wshadow-all with
that flag, no warning is emitted.

Compiler Explorer: https://godbolt.org/z/8cN1-W

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to