OSDN Git Service

PR c++/44157
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / temp_default1.C
1 // { dg-options "-std=c++0x" }
2
3 template<typename T, typename U>
4 struct is_same
5 {
6   static const bool value = false;
7 };
8
9 template<typename T>
10 struct is_same<T, T> {
11   static const bool value = true;
12 };
13
14 template<typename T = int> void f()
15 {
16   static_assert(is_same<T, int>::value, 
17                 "T can only be instantiated with an int");
18 }
19
20 template<typename T = int, typename U>
21 void f(U)
22 {
23   static_assert(is_same<T, int>::value, 
24                 "T can only be instantiated with an int");
25 }
26
27 void g()
28 {
29   float pi = 3.14159;
30   f();
31   f(pi);
32 }