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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [bases.C] - Rev 696

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-options "-std=gnu++0x -w" }
// { dg-do run }

#include<typeinfo>
#include<cassert>

// A simple typelist
template<typename... _Elements> struct types {};

// Simple bases implementation
template<typename T> struct b {
  typedef types<__bases(T)...> type;
};

// Simple direct_bases implementation
template<typename T> struct db {
  typedef types<__direct_bases(T)...> type;
};

template <class,class> struct assert_same_type;
template <class T> struct assert_same_type<T,T> {};

struct A {};
struct C : virtual A {};
struct D : public C {};
struct B : D, virtual A {};
struct E : C, virtual D, B {};
struct  F : A, B, E {};

int main() {
  assert_same_type<b<F>::type, types<A,C,D,A,C,D,B,C,C,D,B,E>>();
  assert_same_type<db<F>::type, types<A,B,E>>();
  assert_same_type<db<int>::type, types<>>();
  return 0;
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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