summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/spec21.C
blob: e04ac5a2da9484d8694f15fb500d85ca954329c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 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;
}