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

            Bug ID: 86823
           Summary: [6/7/8/9 Regression] private member template
                    struct/class is publicly accessible
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tadeus.prastowo at unitn dot it
  Target Milestone: ---

The following MWE is correctly rejected by GCC version <= 5.5 (cf.
https://godbolt.org/g/Me9i13 (5.5) and https://godbolt.org/g/E7TMAj (4.5.3))
and clang (cf. https://godbolt.org/g/osAZMo (6.0.0)), but incorrectly accepted
by GCC version >= 6.1 (cf. https://godbolt.org/g/nWUuEY (6.1),
https://godbolt.org/g/VmmhY2 (8.2), and https://godbolt.org/g/gwwuG6 (trunk))

struct X {
private:
  template<typename T> // comment this out, and GCC >= 6.1 correctly rejects.
  struct Y {
    int data;
  };
public:
  int value;
};

int main() {
  typename X::Y
    <int> // comment this out, and GCC >= 6.1 correctly rejects.
    a;
}

Reply via email to