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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [inline14.C] - Blame information for rev 844

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do assemble  }
2
// Origin: Gerald Pfeifer 
3
 
4
#include 
5
 
6
struct IDENT
7
    {
8
    enum TYPE { Variable, Constant } type;
9
 
10
    std::ostream& printTo(std::ostream& out) const
11
        {
12
        switch (type)
13
            {
14
            case Variable:
15
                out << '_';
16
                break;
17
            default:
18
                break;
19
            }
20
        return out;
21
        }
22
    };
23
 
24
 
25
template 
26
struct TC
27
    {
28
    IDENT i;
29
 
30
    const IDENT& getIdent() const
31
        {
32
        return i;
33
        }
34
    };
35
 
36
template 
37
inline std::ostream& operator<< (std::ostream& out, const TC &c)
38
    {
39
    c.getIdent().printTo(out);
40
    return out;
41
    }
42
 
43
void foo(const TC &c)
44
    {
45
    std::cerr << c
46
         << ": " // This line is crucial!
47
         << c
48
         << std::endl;
49
    }

powered by: WebSVN 2.1.0

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