http://llvm.org/bugs/show_bug.cgi?id=8027
Summary: Friend template declarations get confused by member
declarations
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
I have *no* idea if this is legit C++, but GCC accepts it, and in strange cases
even requires it when it shouldn't:
% cat t2.cc
template <typename T> struct S;
template <typename T> const S<T> operator + (S<T>, S<T>);
template <typename T> struct S {
const S<T> operator + ();
friend const S<T> operator + <> (S<T>, S<T>);
};
S<int> s;
% ./bin/clang -fsyntax-only t2.cc
t2.cc:7:21: error: friends can only be classes or functions
friend const S<T> operator + <> (S<T>, S<T>);
^
t2.cc:7:31: error: expected ';' at end of declaration list
friend const S<T> operator + <> (S<T>, S<T>);
^
;
2 errors generated.
It's worth noting that reversing the two 'operator +' lines inside of S's
definition fix Clang. =[
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs