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

             Bug #: 56248
           Summary: [DR 580] access checking of template parameters done
                    too early
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org


This code based on the example in [class.access]/6 is rejected:

class A {
  typedef int I; // private member
  template<int> struct Q;
  template<int> friend struct R;
protected:
  struct B { };
};
template<A::I> struct A::Q { };
template<A::I> struct R { };
struct D: A::B, A { };


t.cc:2:15: error: ‘typedef int A::I’ is private
   typedef int I; // private member
               ^
t.cc:8:13: error: within this context
 template<A::I> struct A::Q { };
             ^
t.cc:2:15: error: ‘typedef int A::I’ is private
   typedef int I; // private member
               ^
t.cc:9:13: error: within this context
 template<A::I> struct R { };
             ^
t.cc:6:10: error: ‘struct A::B’ is protected
   struct B { };
          ^
t.cc:10:14: error: within this context
 struct D: A::B, A { };
              ^

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#580 clarifies that
access checking of the template parameters should be delayed until the context
is known.

Reply via email to