URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 301 |
Rev 338 |
// { dg-do "run" }
|
// { dg-do "run" }
|
#include
|
#include
|
|
|
struct A
|
struct A
|
{
|
{
|
double a;
|
double a;
|
double b;
|
double b;
|
};
|
};
|
|
|
union U
|
union U
|
{
|
{
|
double a;
|
double a;
|
double b;
|
double b;
|
};
|
};
|
|
|
class B
|
class B
|
{
|
{
|
B();
|
B();
|
};
|
};
|
|
|
class C
|
class C
|
{
|
{
|
virtual void rotate(int) = 0;
|
virtual void rotate(int) = 0;
|
};
|
};
|
|
|
class D
|
class D
|
{
|
{
|
virtual void rotate(int) { }
|
virtual void rotate(int) { }
|
};
|
};
|
|
|
template
|
template
|
bool
|
bool
|
f()
|
f()
|
{ return __is_abstract(T); }
|
{ return __is_abstract(T); }
|
|
|
template
|
template
|
class My
|
class My
|
{
|
{
|
public:
|
public:
|
bool
|
bool
|
f()
|
f()
|
{ return !!__is_abstract(T); }
|
{ return !!__is_abstract(T); }
|
};
|
};
|
|
|
template
|
template
|
class My2
|
class My2
|
{
|
{
|
public:
|
public:
|
static const bool trait = __is_abstract(T);
|
static const bool trait = __is_abstract(T);
|
};
|
};
|
|
|
template
|
template
|
const bool My2::trait;
|
const bool My2::trait;
|
|
|
template
|
template
|
struct My3_help
|
struct My3_help
|
{ static const bool trait = b; };
|
{ static const bool trait = b; };
|
|
|
template
|
template
|
const bool My3_help::trait;
|
const bool My3_help::trait;
|
|
|
template
|
template
|
class My3
|
class My3
|
{
|
{
|
public:
|
public:
|
bool
|
bool
|
f()
|
f()
|
{ return My3_help::trait; }
|
{ return My3_help::trait; }
|
};
|
};
|
|
|
#define PTEST(T) (__is_abstract(T) && f() \
|
#define PTEST(T) (__is_abstract(T) && f() \
|
&& My().f() && My2::trait && My3().f())
|
&& My().f() && My2::trait && My3().f())
|
|
|
#define NTEST(T) (!__is_abstract(T) && !f() \
|
#define NTEST(T) (!__is_abstract(T) && !f() \
|
&& !My().f() && !My2::trait && !My3().f())
|
&& !My().f() && !My2::trait && !My3().f())
|
|
|
int main()
|
int main()
|
{
|
{
|
assert (NTEST (int));
|
assert (NTEST (int));
|
assert (NTEST (void));
|
assert (NTEST (void));
|
assert (NTEST (A));
|
assert (NTEST (A));
|
assert (NTEST (U));
|
assert (NTEST (U));
|
assert (NTEST (B));
|
assert (NTEST (B));
|
assert (NTEST (B[]));
|
assert (NTEST (B[]));
|
assert (PTEST (C));
|
assert (PTEST (C));
|
assert (NTEST (D));
|
assert (NTEST (D));
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.