[LLVMbugs] [Bug 6827] New: friended template functions don't get to bypass protections

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 13 01:38:08 PDT 2010


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

           Summary: friended template functions don't get to bypass
                    protections
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: oliver at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


clang++ fails to correctly respect friend specifier in template class pointing
to a template function

struct Test { int i; };
template <typename T> class Foo;
template <typename T> Foo<T> foo(T* t){ return Foo<T>(t, true); }
template <typename T> class Foo {
public:
    Foo(T*);
    friend Foo<T> foo<T>(T*);
private:
    Foo(T*, bool);
};


Test globalT;
Foo<Test> f = foo(&globalT);

Compiles in g++ but fails in 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