[llvm-bugs] [Bug 30994] New: Should NamedDecl::declarationReplaces consider friend status?
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 11 23:20:29 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=30994
Bug ID: 30994
Summary: Should NamedDecl::declarationReplaces consider friend
status?
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: yaron.keren at gmail.com
CC: llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk,
vvasilev at cern.ch
Classification: Unclassified
Given the code
namespace boost {
template <class> class shared_ptr {
template <class> friend class shared_ptr;
};
}
shared_ptr<char> c;
shared_ptr<int> i;
shared_ptr<char> is created with its TemplateDecl being the class shared_ptr
while shared_ptr<int> TemplateDecl is the friend TemplateDecl created in
shared_ptr<char>.
This happens because the friend TemplateDecl created in shared_ptr<char>
replaces the original class TemplateDecl.
It seems inconsistent that both ClassTemplateSpecializationDecl have different
TemplateDecl.
To solve this, we could demand same friendness in
NamedDecl::declarationReplaces
bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
...
// Friend should not replace non-friend.
if (OldD->getFriendObjectKind() != getFriendObjectKind())
return false;
--
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/20161112/21e8db04/attachment.html>
More information about the llvm-bugs
mailing list