[LLVMbugs] [Bug 8027] New: Friend template declarations get confused by member declarations
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 30 01:21:04 PDT 2010
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: unassignedclangbugs at nondot.org
ReportedBy: chandlerc at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
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.
More information about the llvm-bugs
mailing list