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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [init/] [init-ref3.C] - Blame information for rev 237

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

Line No. Rev Author Line
1 149 jeremybenn
// Origin: Peter Schmid 
2
 
3
// { dg-do link }
4
 
5
template 
6
class Ptr {
7
protected:
8
  T * ptr;
9
 
10
public:
11
 
12
  Ptr(void) : ptr(0) { };
13
  Ptr(T * p) : ptr(p) { };
14
 
15
  ~Ptr(void) { delete ptr; }
16
 
17
  operator T & () { return *ptr; }
18
};
19
 
20
class base {
21
public:
22
  base(void) { }
23
  ~base(void) { }
24
};
25
 
26
 
27
class foo : public base {
28
private:
29
  foo(const foo & rv);
30
 
31
public:
32
 
33
  foo(void) { }
34
  ~foo(void) { }
35
};
36
 
37
void func2(base & b) {
38
  // ...
39
}
40
 
41
int main () {
42
  Ptr f = new foo;
43
  /* This should not result in a copy; the result of the conversion
44
     operator should be bound directly to the reference argument to
45
     `func2'.  */
46
  func2(f);
47
}

powered by: WebSVN 2.1.0

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