[llvm-bugs] [Bug 5716] Function template not instantiated if declared as friend
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Feb 20 22:05:34 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=5716
Bastien Penavayre <bastienPenava at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bastienPenava at gmail.com
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #2 from Bastien Penavayre <bastienPenava at gmail.com> ---
The example given is resolved but there are other cases that aren't,
for instance:
struct flag
{
template<class T>
friend void *init(flag, T);
};
template<class R>
struct writer
{
template<class T>
friend void *init(flag, T) {
return nullptr;
}
};
int main()
{
void *data = init(flag{}, 42);
writer<int> tmp;
//note that if the next line is uncommented the link error disappear:
//sizeof(init(flag{}, 42));
}
produce the error:
undefined reference to `void* init<int>(flag, int)'
--
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/20210221/9c8c41e8/attachment-0001.html>
More information about the llvm-bugs
mailing list