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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [addr-const1.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2003 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 19 Apr 2003 
5
 
6
// PR 9881. address-constant-expression not static initialized
7
 
8
struct bar {
9
  double p;
10
}; // bar
11
 
12
bar v;
13
static bool error = false;
14
 
15
struct foo {
16
  static double *a;
17
  static double *b;
18
  static double storage;
19
};
20
 
21
struct baz {
22
  baz () {
23
    if (foo::a != &v.p)
24
      error = true;
25
    if (foo::b != &foo::storage)
26
      error = true;
27
  }
28
};
29
 
30
baz f; // Get constructor to run before any other non-static initializers
31
 
32
double *foo::a = &(((bar *)(&v))->p);
33
double *foo::b = &(((bar *)(&foo::storage))->p);
34
double foo::storage = 0.0;
35
 
36
int main() {
37
  return error;
38
}

powered by: WebSVN 2.1.0

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