[LLVMbugs] [Bug 23342] New: Warn when a template class declares a dependent friend function [-Wnon-template-friend]
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Apr 24 15:00:52 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23342
Bug ID: 23342
Summary: Warn when a template class declares a dependent friend
function [-Wnon-template-friend]
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: rnk at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The out-of-line friend declaration is very likely broken because the
declaration is not part of the template. GCC has a -Wnon-template-friend
warning that finds this.
template <typename T>
struct Arg {
friend bool operator==(const Arg& lhs, T rhs) {
return false;
}
friend bool operator!=(const Arg& lhs, T rhs);
};
template <typename T>
bool operator!=(const Arg<T>& lhs, T rhs) {
return true;
}
bool foo() {
Arg<int> arg;
return (arg == 42) || (arg != 42);
}
--
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/20150424/00c4370c/attachment.html>
More information about the llvm-bugs
mailing list