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++.other/] [cast6.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  }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 
// Contributed by Nathan Sidwell 28 Nov 2000 
// We failed to reject static_cast and implicit conversions of pointers to
// We failed to reject static_cast and implicit conversions of pointers to
// member that traversed a virtual base.
// member that traversed a virtual base.
struct bar
struct bar
{
{
  int barm;
  int barm;
    static void a();
    static void a();
};
};
struct filler1 {int fm;};
struct filler1 {int fm;};
struct filler2 {int fm;};
struct filler2 {int fm;};
struct filler3 {int fm;};
struct filler3 {int fm;};
struct filler4 {int fm;};
struct filler4 {int fm;};
struct baz : filler1, bar, filler2
struct baz : filler1, bar, filler2
{
{
  int bazm;
  int bazm;
};
};
struct foo : filler3, virtual baz, filler4
struct foo : filler3, virtual baz, filler4
{
{
    static void a();
    static void a();
    void b() {}
    void b() {}
    int m;
    int m;
};
};
typedef void (bar::*barfPtr)();
typedef void (bar::*barfPtr)();
typedef void (foo::*foofPtr)();
typedef void (foo::*foofPtr)();
typedef int bar::*barmPtr;
typedef int bar::*barmPtr;
typedef int foo::*foomPtr;
typedef int foo::*foomPtr;
struct X;
struct X;
typedef void (X::*xfPtr) ();
typedef void (X::*xfPtr) ();
typedef int X::*xmPtr;
typedef int X::*xmPtr;
int main ()
int main ()
{
{
  {
  {
    foofPtr fp = &foo::b;
    foofPtr fp = &foo::b;
    barfPtr bp = static_cast  (fp);    // { dg-error "via virtual base" } invalid static_cast
    barfPtr bp = static_cast  (fp);    // { dg-error "via virtual base" } invalid static_cast
    foofPtr fp2 = static_cast  (bp);   // { dg-error "via virtual base" } invalid static_cast
    foofPtr fp2 = static_cast  (bp);   // { dg-error "via virtual base" } invalid static_cast
    foofPtr fp3 = bp;                           // { dg-error "via virtual base" } cannot convert
    foofPtr fp3 = bp;                           // { dg-error "via virtual base" } cannot convert
    fp3 = (foofPtr)bp;                          // { dg-error "via virtual base" } via virtual base
    fp3 = (foofPtr)bp;                          // { dg-error "via virtual base" } via virtual base
    foomPtr fmp = &foo::m;
    foomPtr fmp = &foo::m;
    barmPtr bmp = static_cast  (fmp);  // { dg-error "via virtual base" } invalid static_cast
    barmPtr bmp = static_cast  (fmp);  // { dg-error "via virtual base" } invalid static_cast
    foomPtr fmp2 = static_cast  (bmp); // { dg-error "via virtual base" } invalid static_cast
    foomPtr fmp2 = static_cast  (bmp); // { dg-error "via virtual base" } invalid static_cast
    foomPtr fmp3 = bmp;                         // { dg-error "via virtual base" } cannot convert
    foomPtr fmp3 = bmp;                         // { dg-error "via virtual base" } cannot convert
    fmp3 = (foomPtr)bmp;                        // { dg-error "via virtual base" } via virtual base
    fmp3 = (foomPtr)bmp;                        // { dg-error "via virtual base" } via virtual base
  }
  }
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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