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;
|
};
|
};
|
|
|
struct B
|
struct B
|
{
|
{
|
B& operator=(const B&) { return *this;}
|
B& operator=(const B&) { return *this;}
|
};
|
};
|
|
|
struct C
|
struct C
|
{
|
{
|
virtual int f() { return 1; }
|
virtual int f() { return 1; }
|
};
|
};
|
|
|
struct D
|
struct D
|
: public B { };
|
: public B { };
|
|
|
struct E
|
struct E
|
: public A { };
|
: public A { };
|
|
|
struct F
|
struct F
|
{
|
{
|
A a;
|
A a;
|
};
|
};
|
|
|
struct G
|
struct G
|
{
|
{
|
B b;
|
B b;
|
};
|
};
|
|
|
template
|
template
|
bool
|
bool
|
f()
|
f()
|
{ return __has_trivial_assign(T); }
|
{ return __has_trivial_assign(T); }
|
|
|
template
|
template
|
class My
|
class My
|
{
|
{
|
public:
|
public:
|
bool
|
bool
|
f()
|
f()
|
{ return !!__has_trivial_assign(T); }
|
{ return !!__has_trivial_assign(T); }
|
};
|
};
|
|
|
template
|
template
|
class My2
|
class My2
|
{
|
{
|
public:
|
public:
|
static const bool trait = __has_trivial_assign(T);
|
static const bool trait = __has_trivial_assign(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) (__has_trivial_assign(T) && f() \
|
#define PTEST(T) (__has_trivial_assign(T) && f() \
|
&& My().f() && My2::trait && My3().f())
|
&& My().f() && My2::trait && My3().f())
|
|
|
#define NTEST(T) (!__has_trivial_assign(T) && !f() \
|
#define NTEST(T) (!__has_trivial_assign(T) && !f() \
|
&& !My().f() && !My2::trait && !My3().f())
|
&& !My().f() && !My2::trait && !My3().f())
|
|
|
int main()
|
int main()
|
{
|
{
|
assert (PTEST (int));
|
assert (PTEST (int));
|
assert (NTEST (int (int)));
|
assert (NTEST (int (int)));
|
assert (NTEST (void));
|
assert (NTEST (void));
|
assert (PTEST (A));
|
assert (PTEST (A));
|
assert (PTEST (U));
|
assert (PTEST (U));
|
assert (NTEST (B));
|
assert (NTEST (B));
|
assert (NTEST (C));
|
assert (NTEST (C));
|
assert (NTEST (D));
|
assert (NTEST (D));
|
assert (PTEST (E));
|
assert (PTEST (E));
|
assert (PTEST (E[]));
|
assert (PTEST (E[]));
|
assert (PTEST (F));
|
assert (PTEST (F));
|
assert (NTEST (G));
|
assert (NTEST (G));
|
assert (NTEST (const A));
|
assert (NTEST (const A));
|
assert (NTEST (A&));
|
assert (NTEST (A&));
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.