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++/34920] New: Members in nameless union


Members in nameless union defined in template base class cannot be accessed by
template derived class. Methods in base class can access members.

Tried on 3.4.5 (mingw) and 4.1.2 (gentoo)

Simplified code :

template <typename TYPE>
class base
{
  public :
    typedef TYPE arrayType1[4];    
    typedef TYPE arrayType2[2][2]; 
    union {
      arrayType1 o; ///< One dimensional array
      arrayType2 t; ///< Two dimensional array

      struct
      {
        TYPE m11; TYPE m12; TYPE m13; TYPE m14;
      };
    };

    void base_funk()
    {
      o[0] = 0;
    }
};

template <typename TYPE>
class derived : public base<TYPE>
{
  public :
    void der_funk(TYPE v) {o[0] = v;}
};


-- 
           Summary: Members in nameless union
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: extronus at gmail dot com


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


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