[llvm-bugs] [Bug 25334] New: Access to a public template alias declaration that refers to friend's private nested type is not allowed.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 28 04:46:14 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25334

            Bug ID: 25334
           Summary: Access to a public template alias declaration that
                    refers to friend's private nested type is not allowed.
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: officesamurai at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15179
  --> https://llvm.org/bugs/attachment.cgi?id=15179&action=edit
test code (also in the text)

The test case that fails is:

struct FooAccessor
{
    template <typename T>
    using Foo = typename T::Foo;
};

class Type
{
    friend struct FooAccessor;

    using Foo = int;
};

int main()
{
    FooAccessor::Foo<Type> t;
}


The result is:


$ clang++ test.cpp -std=c++11
test.cpp:4:5: error: 'Foo' is a private member of 'Type'
    using Foo = typename T::Foo;
    ^
test.cpp:11:11: note: implicitly declared private here
    using Foo = int;
          ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151028/9a8d0f93/attachment.html>


More information about the llvm-bugs mailing list