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/] [spec21.C] - Rev 149

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

// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 31 Mar 2005 <nathan@codesourcery.com>

// { dg-do run }
// DR214

template <class T> T f(int) {return 0;}
template <class T, class U> T f(U){return 1;}

template <typename T, typename R> T checked_cast (R const &) {return 0;}
template <typename T, typename R> T checked_cast (R *) {return 1;}


int main ()
{
  int i = 0;

  if (f<int>(1))
    return 1;
  
  if (checked_cast<int>(i) != 0)
    return 2;

  if (checked_cast<int>(&i) != 1)
    return 3;

  return 0;
}

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

powered by: WebSVN 2.1.0

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