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

            Bug ID: 45260
           Summary: -Wshadow doesn't warn when shadowing symbol from
                    anonymous or outer namespace
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: h...@chromium.org
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

For example:

$ cat /tmp/a.cc
namespace {
constexpr int foo = 42;
}

namespace ns {
int f() {
  constexpr int foo = 42;
  return foo;
}
}
$ bin/clang -c -Wshadow /tmp/a.cc
(no warning)

There's also no warning if the first 'foo' is at file-scope (i.e. without any
namespace). However, if the first 'foo' is put in 'namespace ns', then it does
warn.

Is there a reason it doesn't warn in the first two cases? It still seems like a
case of shadowing to me.

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