[llvm-bugs] [Bug 37556] New: Improper symbol redefinition diagnostic for names in different declarative regions
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue May 22 15:58:58 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37556
Bug ID: 37556
Summary: Improper symbol redefinition diagnostic for names in
different declarative regions
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: Casey at Carter.net
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Compiling this well-formed program with -std=c++2a:
namespace X {
inline namespace Y { int swap; }
template<class>
struct S {
friend void swap(S&, S&) {}
};
}
int main() {
X::S<int> s1, s2;
swap(s1, s2);
}
produces diagnostics (https://godbolt.org/g/ceWLxY):
<source>:6:21: error: redefinition of 'swap' as different kind of symbol
friend void swap(S&, S&) {}
^
<source>:11:15: note: in instantiation of template class 'X::S<int>'
requested here
X::S<int> s1, s2;
^
<source>:2:30: note: previous definition is here
inline namespace Y { int swap; }
^
1 error generated.
Note that the program compiles successfully if S is replaced by a non-template
class. Discussion on the CWG reflector verified that this program is
well-formed, including Richard's statement "Oops, Clang's redeclaration check
in the template instantiation case is incorrectly performing a redeclaration
lookup as if for a qualified name here, rather than a redeclaration lookup for
an unqualified name."
--
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/20180522/48cf0630/attachment.html>
More information about the llvm-bugs
mailing list