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++.jason/] [template36.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// Testcase for implicit 'typename' and resolution of 'typename's in the
// Testcase for implicit 'typename' and resolution of 'typename's in the
// current scope.
// current scope.
class base1 {
class base1 {
public:
public:
    int bar() const
    int bar() const
    { return 1; }
    { return 1; }
};
};
class base2 {
class base2 {
public:
public:
    int bar() const
    int bar() const
    { return 0; }
    { return 0; }
};
};
template
template
struct base_trait {
struct base_trait {
    typedef base1 base;
    typedef base1 base;
};
};
template<>
template<>
struct base_trait {
struct base_trait {
    typedef base2 base;
    typedef base2 base;
};
};
template
template
class weird : public base_trait::base {
class weird : public base_trait::base {
public:
public:
    typedef typename base_trait::base base;
    typedef typename base_trait::base base;
    base f ();
    base f ();
    int base::* g ();
    int base::* g ();
    int zowee() const
    int zowee() const
    { return this->bar(); }
    { return this->bar(); }
};
};
template 
template 
typename weird::base weird::f ()
typename weird::base weird::f ()
{
{
    return base();
    return base();
}
}
// The standard does not allow this case; the `typename' keyword may
// The standard does not allow this case; the `typename' keyword may
// not appear in a ptr-operator.
// not appear in a ptr-operator.
#if 0
#if 0
template 
template 
int typename weird::base::* weird::g ()
int typename weird::base::* weird::g ()
{ return 0; }
{ return 0; }
#endif
#endif
int main()
int main()
{
{
    weird z;
    weird z;
    return z.zowee() || z.f().bar();
    return z.zowee() || z.f().bar();
}
}
 
 

powered by: WebSVN 2.1.0

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