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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [conv3.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 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
template  struct C
9
{
10
  operator T ()
11
  {
12
    return 0;
13
  }
14
  template  operator T2 ()
15
  {
16
    return 1;
17
  }
18
  int Foo ()
19
  {
20
    return operator T ();
21
  }
22
  template  int Baz ()
23
  {
24
    return static_cast  (operator T2 ());
25
  }
26
};
27
 
28
int main ()
29
{
30
  int r;
31
  C c;
32
 
33
  r = c.Foo ();
34
  if (r)
35
    return 1;
36
  r = c.Baz ();
37
  if (r)
38
    return 2;
39
  r = c.Baz ();
40
  if (!r)
41
    return 3;
42
  return 0;
43
}

powered by: WebSVN 2.1.0

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