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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [sfinae27.C] - Rev 749

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

// Origin: PR c++/46162

struct small_type { char dummy; };
struct large_type { char dummy[2]; };

template<class T>
struct has_foo_member_variable
{
  template<int T::*> struct tester;
  template<class U> static small_type has_foo(tester<&U::foo> *);
  template<class U> static large_type has_foo(...);
  static const bool value = (sizeof(has_foo<T>(0)) == sizeof(small_type));
};

struct A
{
  static int foo()
  {
    return 0;
  }
};

struct B
{
  static int foo;
};

void
bar()
{
  bool b = has_foo_member_variable<A>::value;
}

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.