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++.dg/] [template/] [partial6.C] - Rev 301

Compare with Previous | Blame | View Log

// PR c++/41703
// The second GetAllSize template is more specialized because even though
// deduction on each parameter type succeeds, we never get a template
// argument for its X to make it match the first template.

template <typename T, int (T::*)() const>
struct TSizeEnabler
{
    typedef T TClass;
};

template <typename X>
int
GetAllSize(const X &Var)
{ return sizeof(Var); }

template <typename X>
int
GetAllSize(const typename TSizeEnabler<X, &X::func>::TClass &Var)
{ return Var.func(); }

struct H
{
    int func() const;
};

int main()
{
    H b;
    return GetAllSize< H >(b);
}

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.