[Bug c++/34920] New: Members in nameless union

2008-01-21 Thread extronus at gmail dot com
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 
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 
class derived : public base
{
  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



[Bug c++/34920] Members in nameless union

2008-01-21 Thread extronus at gmail dot com


--- Comment #2 from extronus at gmail dot com  2008-01-22 06:04 ---
more simplified

-
template 
struct base
{
  float a;
};

template 
class derv : public base
{
  void der_funk()
  {
a = 0;
  }
};


while this one works
--
template 
struct base
{
  float a;
};

template 
class derv : public base
{

  void der_funk()
  {
a = 0;
  }
};


-- 


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