Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / template / spec21.C
blobe04ac5a2da9484d8694f15fb500d85ca954329c8
1 // Copyright (C) 2005 Free Software Foundation, Inc.
2 // Contributed by Nathan Sidwell 31 Mar 2005 <nathan@codesourcery.com>
4 // { dg-do run }
5 // DR214
7 template <class T> T f(int) {return 0;}
8 template <class T, class U> T f(U){return 1;}
10 template <typename T, typename R> T checked_cast (R const &) {return 0;}
11 template <typename T, typename R> T checked_cast (R *) {return 1;}
14 int main ()
16   int i = 0;
18   if (f<int>(1))
19     return 1;
20   
21   if (checked_cast<int>(i) != 0)
22     return 2;
24   if (checked_cast<int>(&i) != 1)
25     return 3;
27   return 0;