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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs