This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52373] New: template usage drops some checks on the accessibility of a member


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

             Bug #: 52373
           Summary: template usage drops some checks on the accessibility
                    of a member
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sylvestre@debian.org


Considering this code:
----
class A
{
    struct st
    {
         static void f();
    };
};

template <typename t> void foo()
{
    A::st::f();
}
---
g++ accepts it.

If I remove "template <typename t>", an error is triggered (which is the
expected behavior):
plop.cpp: In function âvoid foo()â:
plop.cpp:4:12: error: âstruct A::stâ is private
plop.cpp:12:5: error: within this context


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]