[llvm-bugs] [Bug 42244] New: incompatible declaration
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 11 22:30:44 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42244
Bug ID: 42244
Summary: incompatible declaration
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
clang is 9.0.0, and my code is as follows:
template<int...> struct A
{
void foo();
};
struct B
{
template<int N> friend void A<N>::A::foo();
};
clang accepts the code. gcc rejects it:
source>:7:44: error: member 'void typename A<N>::A::foo()' declared as friend
before type 'typename A<N>::A' defined
7 | template<int N> friend void A<N>::A::foo();
| ^
Compiler returned: 1
icc also rejects it:
<source>(7): error: declaration is incompatible with nontype "<unnamed>
A<N>::A::foo" (declared at line 7)
template<int N> friend void A<N>::A::foo();
^
compilation aborted for <source> (code 2)
Compiler returned: 2
--
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/20190612/1d74b8f3/attachment.html>
More information about the llvm-bugs
mailing list