URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// Origin: Peter Schmid
|
// Origin: Peter Schmid
|
|
|
// { dg-do link }
|
// { dg-do link }
|
|
|
template
|
template
|
class Ptr {
|
class Ptr {
|
protected:
|
protected:
|
T * ptr;
|
T * ptr;
|
|
|
public:
|
public:
|
|
|
Ptr(void) : ptr(0) { };
|
Ptr(void) : ptr(0) { };
|
Ptr(T * p) : ptr(p) { };
|
Ptr(T * p) : ptr(p) { };
|
|
|
~Ptr(void) { delete ptr; }
|
~Ptr(void) { delete ptr; }
|
|
|
operator T & () { return *ptr; }
|
operator T & () { return *ptr; }
|
};
|
};
|
|
|
class base {
|
class base {
|
public:
|
public:
|
base(void) { }
|
base(void) { }
|
~base(void) { }
|
~base(void) { }
|
};
|
};
|
|
|
|
|
class foo : public base {
|
class foo : public base {
|
private:
|
private:
|
foo(const foo & rv);
|
foo(const foo & rv);
|
|
|
public:
|
public:
|
|
|
foo(void) { }
|
foo(void) { }
|
~foo(void) { }
|
~foo(void) { }
|
};
|
};
|
|
|
void func2(base & b) {
|
void func2(base & b) {
|
// ...
|
// ...
|
}
|
}
|
|
|
int main () {
|
int main () {
|
Ptr f = new foo;
|
Ptr f = new foo;
|
/* This should not result in a copy; the result of the conversion
|
/* This should not result in a copy; the result of the conversion
|
operator should be bound directly to the reference argument to
|
operator should be bound directly to the reference argument to
|
`func2'. */
|
`func2'. */
|
func2(f);
|
func2(f);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.