[llvm-bugs] [Bug 45260] New: -Wshadow doesn't warn when shadowing symbol from anonymous or outer namespace
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 20 03:52:11 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: hans at chromium.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200320/7239bcc7/attachment.html>
More information about the llvm-bugs
mailing list