OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [decltype5.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-do "compile" }
2
// { dg-options "-std=gnu++0x" }
3
 
4
template
5
struct is_same
6
{
7
  static const bool value = false;
8
};
9
 
10
template
11
struct is_same
12
{
13
  static const bool value = true;
14
};
15
 
16
#define CHECK_DECLTYPE(DECLTYPE,RESULT) \
17
  static_assert(is_same< DECLTYPE , RESULT >::value, #RESULT)
18
 
19
template F create_a();
20
 
21
template
22
decltype(create_a()(create_a())) forward(F f, const T1& a1)
23
{
24
  return f(a1);
25
}
26
 
27
struct identity {
28
  template
29
  const T& operator()(const T& x) { return x; }
30
};
31
 
32
 
33
identity id;
34
int i;
35
float f;
36
 
37
CHECK_DECLTYPE(decltype(forward(id, i)), const int&);
38
CHECK_DECLTYPE(decltype(forward(id, f)), const float&);

powered by: WebSVN 2.1.0

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