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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [regress/] [regress4.C] - Rev 774

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

// PR c++/49663
// { dg-options -std=c++0x }

struct Nosm
{
    int m_R;
};

namespace dx {

    struct onc
    {
        typedef void(*Cb)();

        onc(Cb cb);
    };

    struct grac
    {
        template<class Derived> static void once();
    };

    template<class Derived>
        struct tonc : onc
        {
            tonc() : onc(&grac::once<Derived>) {}

            static Derived& get();
        };

    template<class Derived> void grac::once()
    {
        tonc<Derived>::get().h();
    }
}

namespace
{
    template<typename T, int = sizeof(&T::m_R)>
        struct has_R { };

    template<typename T>
        inline void
        setR(T* m, has_R<T>* = 0)
        { }

    inline void setR(...) { }
}

template<typename M>
    struct Qmi
    : dx::tonc<Qmi<M> >
    {
        void h()
        {
            setR(&msg);
        }

        M msg;
    };

Qmi<Nosm> x;

Go to most recent revision | 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.