[Bug c++/78986] [7/8/9 Regression] template inner classes are not affected by access specifiers

balakrishnan.erode at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Dec 14 20:58:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78986

Balakrishnan B <balakrishnan.erode at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |balakrishnan.erode at gmail dot co
                   |                            |m

--- Comment #2 from Balakrishnan B <balakrishnan.erode at gmail dot com> ---
This has nothing to do with inheritance. If the inner class is template, access
specifiers are ignored. Simpler example:

class A {
    struct B1 {};

    template<class T>
    struct B2 {};
};

void foo() {    
    //A::B1 b1; //This doesn't compile (GOOD)
    A::B2<int> b2; // This compiles (BAD)
}

Explorer: https://gcc.godbolt.org/z/S0YBPu

Bug is present in all versions between GCC 6.1 to trunk. GCC5 and earlier are
good.


More information about the Gcc-bugs mailing list