OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [inline14.C] - Rev 305

Compare with Previous | Blame | View Log

// { dg-do assemble  }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>

#include <iostream>

struct IDENT
    {
    enum TYPE { Variable, Constant } type;

    std::ostream& printTo(std::ostream& out) const
        {
        switch (type)
            {
            case Variable:
                out << '_';
                break;
            default:
                break;
            }
        return out;
        }
    };


template <class T>
struct TC
    {
    IDENT i;

    const IDENT& getIdent() const
        {
        return i;
        }
    };

template <class T>
inline std::ostream& operator<< (std::ostream& out, const TC<T> &c)
    {
    c.getIdent().printTo(out);
    return out;
    }

void foo(const TC<IDENT> &c)
    {
    std::cerr << c 
         << ": " // This line is crucial!
         << c
         << std::endl;
    }

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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