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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [lambda/] [lambda-template.C] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// { dg-options -std=c++0x }
2
// { dg-do run }
3
 
4
extern "C" void abort();
5
 
6
template 
7
auto apply (T t) -> decltype (t())
8
{
9
  return t();
10
}
11
 
12
template 
13
T f(T t)
14
{
15
  T t2 = t;
16
  if (t != [=]()->T { return t; }())
17
    abort ();
18
  if (t != [=] { return t; }())
19
    abort ();
20
  if (t != [=] { return t2; }())
21
    abort ();
22
  if (t != [&] { return t; }())
23
    abort ();
24
  if (t != apply([=]{return t;}))
25
    abort ();
26
 
27
  int i;
28
  [&] (int a)                    { return a+i+t; } (0);
29
  [&] (int a) -> decltype(a)     { return a+i+t; } (0);
30
  [&] (int a) -> decltype(i)     { return a+i+t; } (0);
31
  [&] (int a) -> decltype(t)     { return a+i+t; } (0);
32
  [&] (int a) -> decltype(a+i)   { return a+i+t; } (0);
33
  [&] (int a) -> decltype(a+t)   { return a+i+t; } (0);
34
  [&] (int a) -> decltype(i+t)   { return a+i+t; } (0);
35
  [&] (int a) -> decltype(a+i+t) { return a+i+t; } (0);
36
}
37
 
38
int main()
39
{
40
  f(0xbeef);
41
}

powered by: WebSVN 2.1.0

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