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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [template/] [conv2.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2001 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 29 Dec 2001 
5
 
6
// PR 4361. Template conversion operators were not overloaded.
7
 
8
class C
9
{
10
public:
11
 
12
  operator float () {return 2;}
13
 
14
  operator int ()
15
  {
16
    return 0;
17
  }
18
 
19
  template
20
  operator int ()
21
  { return 1;
22
  }
23
};
24
 
25
int main ()
26
{
27
  C p;
28
  int r;
29
 
30
  r = p.operator int ();
31
  if (r)
32
    return r;
33
  r = static_cast  (p);
34
 
35
  if (r)
36
    return r + 2;
37
 
38
  return 0;
39
}

powered by: WebSVN 2.1.0

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