URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 157 |
Rev 223 |
// Tests for local types
|
// Tests for local types
|
|
|
void marker1 (void)
|
void marker1 (void)
|
{
|
{
|
}
|
}
|
|
|
void marker2 (void)
|
void marker2 (void)
|
{
|
{
|
}
|
}
|
|
|
int foobar (int x)
|
int foobar (int x)
|
{
|
{
|
class Local {
|
class Local {
|
public:
|
public:
|
int loc1;
|
int loc1;
|
char loc_foo (char c)
|
char loc_foo (char c)
|
{
|
{
|
return c + 3;
|
return c + 3;
|
}
|
}
|
};
|
};
|
|
|
Local l;
|
Local l;
|
static Local l1;
|
static Local l1;
|
char c;
|
char c;
|
|
|
marker1 ();
|
marker1 ();
|
|
|
l.loc1 = 23;
|
l.loc1 = 23;
|
|
|
c = l.loc_foo('x');
|
c = l.loc_foo('x');
|
return c + 2;
|
return c + 2;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
int c;
|
int c;
|
|
|
c = foobar (31);
|
c = foobar (31);
|
|
|
{ // inner block
|
{ // inner block
|
class InnerLocal {
|
class InnerLocal {
|
public:
|
public:
|
char ilc;
|
char ilc;
|
int * ip;
|
int * ip;
|
int il_foo (unsigned const char & uccr)
|
int il_foo (unsigned const char & uccr)
|
{
|
{
|
return uccr + 333;
|
return uccr + 333;
|
}
|
}
|
class NestedInnerLocal {
|
class NestedInnerLocal {
|
public:
|
public:
|
int nil;
|
int nil;
|
int nil_foo (int i)
|
int nil_foo (int i)
|
{
|
{
|
return i * 27;
|
return i * 27;
|
}
|
}
|
};
|
};
|
NestedInnerLocal nest1;
|
NestedInnerLocal nest1;
|
};
|
};
|
|
|
InnerLocal il;
|
InnerLocal il;
|
|
|
il.ilc = 'b';
|
il.ilc = 'b';
|
il.ip = &c;
|
il.ip = &c;
|
marker2();
|
marker2();
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.