[Bug 45775] (c++) Private templated classes/structs inside a class.

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 24 09:35:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45775

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |redi at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-09-24 09:35:15 UTC ---
Your analysis is incorrect, A::B<T> is not accessible because it's a template. 
The bug is that template functions do not obey access control.

If you make print_private_class a template then it can access A::C 

template<unsigned T>
void print_private_class(const A::C &ac)
{
    printf("something\n");
}

int main(int, char**)
{
    A a;

    print_private_class<0>(a.getAc());

    return 0;
}


This is a dup of PR c++/41437

*** This bug has been marked as a duplicate of bug 41437 ***

-- 
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Gcc-bugs mailing list