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-type.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
// Every id-expression that is a use (_basic.def.odr_ 3.2) of an entity
2
// captured by copy is transformed into an access to the corresponding
3
// unnamed data member of the closure type.
4
//...
5
// Every occurrence of decltype((x)) where x is a possibly parenthesized
6
// id-expression that names an entity of automatic storage duration is
7
// treated as if x were transformed into an access to a corresponding data
8
// member of the closure type that would have been declared if x were a use
9
// of the denoted entity.
10
 
11
// So, other appearances of 'x' within decltype do not refer to the closure
12
// member, because they are not "use"s in the sense of 3.2.
13
 
14
// { dg-options -std=c++0x }
15
 
16
template
17
struct same_type;
18
template 
19
struct same_type { };
20
 
21
int main()
22
{
23
  int i;
24
  [=] {
25
    same_type();
26
    same_type();
27
    i+1;
28
    same_type();
29
    same_type();
30
  };
31
  [=] {
32
    same_type();
33
    same_type();
34
    same_type();
35
  };
36
  [=] () mutable {
37
    same_type();
38
    same_type();
39
    same_type();
40
  };
41
  [&] {
42
    same_type();
43
    same_type();
44
    same_type();
45
  };
46
  [i] {
47
    same_type();
48
    same_type();
49
  };
50
  [&,i] {
51
    same_type();
52
    same_type();
53
  };
54
  [i] () mutable {
55
    same_type();
56
    same_type();
57
  };
58
  [&,i] () mutable {
59
    same_type();
60
    same_type();
61
  };
62
  [&i] {
63
    same_type();
64
    same_type();
65
  };
66
  [=,&i] {
67
    same_type();
68
    same_type();
69
  };
70
  [] {
71
    same_type();
72
    same_type(); // { dg-error "" "not captured" }
73
  };
74
}

powered by: WebSVN 2.1.0

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