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/] [conv3.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// { dg-do run }
// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2001 
// Contributed by Nathan Sidwell 29 Dec 2001 
// PR 4361. Template conversion operators were not overloaded.
// PR 4361. Template conversion operators were not overloaded.
template  struct C
template  struct C
{
{
  operator T ()
  operator T ()
  {
  {
    return 0;
    return 0;
  }
  }
  template  operator T2 ()
  template  operator T2 ()
  {
  {
    return 1;
    return 1;
  }
  }
  int Foo ()
  int Foo ()
  {
  {
    return operator T ();
    return operator T ();
  }
  }
  template  int Baz ()
  template  int Baz ()
  {
  {
    return static_cast  (operator T2 ());
    return static_cast  (operator T2 ());
  }
  }
};
};
int main ()
int main ()
{
{
  int r;
  int r;
  C c;
  C c;
  r = c.Foo ();
  r = c.Foo ();
  if (r)
  if (r)
    return 1;
    return 1;
  r = c.Baz ();
  r = c.Baz ();
  if (r)
  if (r)
    return 2;
    return 2;
  r = c.Baz ();
  r = c.Baz ();
  if (!r)
  if (!r)
    return 3;
    return 3;
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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