http://llvm.org/bugs/show_bug.cgi?id=7308

           Summary: Clang doesn't consider conversion function template
                    friends.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


Clang doesn't like this, saying that "u.m_a" is private. 

template <class T>
class A
{
public:
    template <class U>
    operator A<U>() {
        A<U> u;
        u.m_a = m_a; 
        return u;
    }

    template <class U> template<class V>
    friend A<U>::operator A<V>();
private:
    int m_a;
};

void f() {
   A<int> a = A<double>();
}

There seems to be poor support for such friends. Comeau fails with an ICE
assertion failure and GCC doesn't like it either. 

I believe this program is correct according to the Standard (however the
Standard says that you can define function template friends in the friend
declaration - this can't be true for member function templates. Sounds like the
text treats "member function template" and "member template" as being mutually
exclusive?). 

If this is indeed not valid, it would seem to be a good thing to reject this
straight away when the template is parsed.

-- 
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

Reply via email to