Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp0x/pr83160.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 // { dg-do run { target c++11 } } | |
2 // PR c++/83160 failed to capture as lvalue | |
3 | |
4 int main () | |
5 { | |
6 const int a = 0; | |
7 | |
8 if (![&a] (const int *p) | |
9 { | |
10 const int &b = a; | |
11 // We should bind to the outer a | |
12 return &b == p; | |
13 } (&a)) | |
14 return 1; | |
15 | |
16 if (![&] (const int *p) | |
17 { | |
18 const int &b = a; | |
19 // We should bind to the outer a | |
20 return &b == p; | |
21 } (&a)) | |
22 return 2; | |
23 | |
24 if ([=] (const int *p) | |
25 { | |
26 const int &b = a; | |
27 // We should bind to the captured instance | |
28 return &b == p; | |
29 }(&a)) | |
30 return 3; | |
31 | |
32 return 0; | |
33 } |