OSDN Git Service

* c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / decltype6.C
1 // { dg-do compile }
2 // { dg-options "-std=gnu++0x" }
3
4 template<typename T, typename U> 
5 struct is_same 
6 {
7   static const bool value = false;
8 };
9
10 template<typename T>
11 struct is_same<T, T>
12 {
13   static const bool value = true;
14 };
15
16 template<typename T> const T& foo(); 
17
18
19 int i; 
20
21 template<typename T>
22 struct A 
23
24   double x; 
25 };
26
27 const A<double>* a = new A<double>(); 
28
29 static_assert(is_same<decltype(foo<int>()), const int&>::value,
30               "type should be const int&");
31 static_assert(is_same<decltype(i), int>::value,
32               "type should be int");
33 static_assert(is_same<decltype(a->x), double>::value,
34               "type should be double");
35 static_assert(is_same<decltype((a->x)), const double&>::value,
36               "type should be const double&");