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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [nest19.C] - Blame information for rev 305

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

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// GROUPS passed nested-classes
3
// This is the first line of file ||t3.C||.
4
 
5
// This code demonstrates a variation of the same problem with nested
6
// types.  In C++, nested typedefs are not supposed to be visible
7
// outside their class scopes but they apparently are in gcc 2.4.5.
8
// This code compiles fine in AT&T cfront 3.0.1, but gcc rejects it
9
// with the messages given below.
10
 
11
// If this class does not precede Expr, then the code will compile.
12
 
13
class Another {
14
public:
15
    typedef int Boolean;
16
    enum { FALSE, TRUE };
17
};
18
 
19
// If Expr does not define typedef int Boolean, then the code will
20
// compile.
21
 
22
class Expr {
23
public:
24
    typedef int Boolean;
25
    enum { FALSE, TRUE };
26
    void foo();
27
    void call_something_with(Boolean);
28
};
29
 
30
// t3.C: In method `void  Expr::foo ()':
31
//   t3.C:36: uninitialized const `Boolean'
32
//   t3.C:36: parse error before `='
33
//   t3.C:37: `argument' undeclared (first use this function)
34
//   t3.C:37: (Each undeclared identifier is reported only once
35
//   t3.C:37: for each function it appears in.)
36
 
37
void Expr::foo() {
38
    const Boolean argument = TRUE;
39
    call_something_with(argument);
40
}

powered by: WebSVN 2.1.0

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