OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.abi/] [ptrflags.C] - Diff between revs 305 and 384

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 384
// { dg-do run  }
// { dg-do run  }
// Test rtti pointer flags
// Test rtti pointer flags
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Apr 2000 
// Contributed by Nathan Sidwell 15 Apr 2000 
#include 
#include 
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
#include 
#include 
struct A {int m;};
struct A {int m;};
struct B;
struct B;
using namespace abi;
using namespace abi;
int expect (int flags, std::type_info const &info)
int expect (int flags, std::type_info const &info)
{
{
  abi::__pbase_type_info const *ptr =
  abi::__pbase_type_info const *ptr =
      dynamic_cast  (&info);
      dynamic_cast  (&info);
  if (!ptr)
  if (!ptr)
    return 0;
    return 0;
  if (ptr->__flags != flags)
  if (ptr->__flags != flags)
    return 0;
    return 0;
  return 1;
  return 1;
}
}
int main ()
int main ()
{
{
  if (! expect (0, typeid (A *)))
  if (! expect (0, typeid (A *)))
    return 1;
    return 1;
  if (! expect (1, typeid (A const *)))
  if (! expect (1, typeid (A const *)))
    return 2;
    return 2;
  if (! expect (2, typeid (A volatile *)))
  if (! expect (2, typeid (A volatile *)))
    return 3;
    return 3;
  if (! expect (4, typeid (A *__restrict__ *)))
  if (! expect (4, typeid (A *__restrict__ *)))
    return 4;
    return 4;
  if (! expect (0, typeid (int A::*)))
  if (! expect (0, typeid (int A::*)))
    return 5;
    return 5;
  if (! expect (0, typeid (int A::**)))
  if (! expect (0, typeid (int A::**)))
    return 6;
    return 6;
  if (! expect (8 | 0, typeid (B *)))
  if (! expect (8 | 0, typeid (B *)))
    return 11;
    return 11;
  if (! expect (8 | 1, typeid (B const *)))
  if (! expect (8 | 1, typeid (B const *)))
    return 12;
    return 12;
  if (! expect (8 | 2, typeid (B volatile *)))
  if (! expect (8 | 2, typeid (B volatile *)))
    return 13;
    return 13;
  if (! expect (8 | 4, typeid (B *__restrict__ *)))
  if (! expect (8 | 4, typeid (B *__restrict__ *)))
    return 14;
    return 14;
  if (! expect (16 | 0, typeid (int B::*)))
  if (! expect (16 | 0, typeid (int B::*)))
    return 15;
    return 15;
  if (! expect (8 | 0, typeid (int B::**)))
  if (! expect (8 | 0, typeid (int B::**)))
    return 16;
    return 16;
  if (! expect (8 | 0, typeid (B A::*)))
  if (! expect (8 | 0, typeid (B A::*)))
    return 17;
    return 17;
  if (! expect (24, typeid (B B::*)))
  if (! expect (24, typeid (B B::*)))
    return 18;
    return 18;
  return 0;
  return 0;
}
}
#else
#else
int main ()
int main ()
{
{
  return 0;
  return 0;
}
}
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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