[LLVMbugs] [Bug 12690] New: Friend field access in default template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 28 09:35:27 PDT 2012


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

             Bug #: 12690
           Summary: Friend field access in default template parameter
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: zoxc32 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In the following code, C accesses A's field in the template parameter instanced
from B. G++ and Visual C++ both allow this if B is a friend of A. Clang does
not. I don't know what is the desired behavior here, but it's inconsistent with
other compilers at least.

template<class T, int T::*field = &T::field> class C
{
};

class A
{
    int field;

    friend class B;
};

class B
{
    C<A> field;
};

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