OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [access23.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do assemble  }
// { dg-do assemble  }
// PRMS Id: 9127
// PRMS Id: 9127
// Bug: members of anonymous unions are not access-controlled.
// Bug: members of anonymous unions are not access-controlled.
#include 
#include 
struct Foo {
struct Foo {
public:
public:
  union {
  union {
    long A;
    long A;
    void *pX;
    void *pX;
  };
  };
  union X {
  union X {
    long A;
    long A;
    void *pX;
    void *pX;
  } PUB ;
  } PUB ;
  int PUB_A;
  int PUB_A;
protected:
protected:
  union {
  union {
    long B; // { dg-error "" } protected
    long B; // { dg-error "" } protected
    void *pY; // { dg-error "" } protected
    void *pY; // { dg-error "" } protected
  } ;
  } ;
  union Y {
  union Y {
    long B;
    long B;
    void *pY;
    void *pY;
  } PRT; // { dg-error "" } protected
  } PRT; // { dg-error "" } protected
  int PRT_A; // { dg-error "" } protected
  int PRT_A; // { dg-error "" } protected
private:
private:
  union {
  union {
    long C; // { dg-error "" } private
    long C; // { dg-error "" } private
    void *pZ; // { dg-error "" } private
    void *pZ; // { dg-error "" } private
  };
  };
  union Z {
  union Z {
    long C;
    long C;
    void *pZ;
    void *pZ;
  } PRV; // { dg-error "" } private
  } PRV; // { dg-error "" } private
  int PRV_A; // { dg-error "" } private
  int PRV_A; // { dg-error "" } private
};
};
struct Bar : public Foo {
struct Bar : public Foo {
public:
public:
  void DoSomething() {
  void DoSomething() {
    PUB_A = 0;
    PUB_A = 0;
    Foo::A = 0;
    Foo::A = 0;
    printf("%x\n",pX);
    printf("%x\n",pX);
    Foo::PUB.A = 0;
    Foo::PUB.A = 0;
    printf("%x\n",PUB.pX);
    printf("%x\n",PUB.pX);
    B = 0;
    B = 0;
    printf("%x\n",Foo::pY);
    printf("%x\n",Foo::pY);
    PRT_A = 0;
    PRT_A = 0;
    PRT.B = 0;
    PRT.B = 0;
    printf("%x\n",Foo::PRT.pY);
    printf("%x\n",Foo::PRT.pY);
    PRV_A = 0;                  // { dg-error "" }
    PRV_A = 0;                  // { dg-error "" }
    Foo::C = 0;                 // { dg-error "" }
    Foo::C = 0;                 // { dg-error "" }
    printf("%x\n",pZ);          // { dg-error "" }
    printf("%x\n",pZ);          // { dg-error "" }
    Foo::PRV.C = 0;             // { dg-error "" }
    Foo::PRV.C = 0;             // { dg-error "" }
    printf("%x\n",PRV.pZ);      // { dg-error "" }
    printf("%x\n",PRV.pZ);      // { dg-error "" }
  }
  }
};
};
int main()
int main()
{
{
  Foo a;
  Foo a;
  a.PUB_A = 0;
  a.PUB_A = 0;
  a.A = 0;
  a.A = 0;
  printf("%x\n",a.pX);
  printf("%x\n",a.pX);
  a.PRT_A = 0;                  // { dg-error "" }
  a.PRT_A = 0;                  // { dg-error "" }
  a.B = 0;                      // { dg-error "" }
  a.B = 0;                      // { dg-error "" }
  printf("%x\n",a.pY);          // { dg-error "" }
  printf("%x\n",a.pY);          // { dg-error "" }
  a.PRV_A = 0;                  // { dg-error "" }
  a.PRV_A = 0;                  // { dg-error "" }
  a.C = 0;                      // { dg-error "" }
  a.C = 0;                      // { dg-error "" }
  printf("%x\n",a.pZ);          // { dg-error "" }
  printf("%x\n",a.pZ);          // { dg-error "" }
  a.PUB.A = 0;
  a.PUB.A = 0;
  printf("%x\n",a.PUB.pX);
  printf("%x\n",a.PUB.pX);
  a.PRT.B = 0;                  // { dg-error "" }
  a.PRT.B = 0;                  // { dg-error "" }
  printf("%x\n",a.PRT.pY);      // { dg-error "" }
  printf("%x\n",a.PRT.pY);      // { dg-error "" }
  a.PRV.C = 0;                  // { dg-error "" }
  a.PRV.C = 0;                  // { dg-error "" }
  printf("%x\n",a.PRV.pZ);      // { dg-error "" }
  printf("%x\n",a.PRV.pZ);      // { dg-error "" }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.