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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [static6.C] - Blame information for rev 316

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

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/31806
2
// { dg-do run }
3
// { dg-options "-O2 -fno-inline -fno-threadsafe-statics" }
4
 
5
extern "C" void abort(void);
6
 
7
struct A
8
{
9
    void *d;
10
};
11
 
12
static const A& staticA()
13
{
14
    static A s_static;
15
    return s_static;
16
}
17
 
18
void assert_failed()
19
{
20
    abort();
21
}
22
 
23
A testMethod()
24
{
25
    static const A& s = staticA( );
26
    if (&s == 0)
27
        assert_failed();
28
    return s;
29
}
30
 
31
int main()
32
{
33
    testMethod();
34
    return 0;
35
}

powered by: WebSVN 2.1.0

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