URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [lambda/] [lambda-mutable.C] - Rev 301
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do "run" }
// { dg-options "-std=c++0x" }
#include <cassert>
int main() {
int i = 1;
const char* s1 = "hello";
const char* s2 = s1;
[i, s2] () mutable -> void { i = 2; s2 = "world"; } ();
//[i, s2] () -> void { i = 2; s2 = "world"; } (); // { dg-error: "assignment of data-member in read-only structure" }
assert(i == 1);
assert(s1 == s2);
return 0;
}
Go to most recent revision | Compare with Previous | Blame | View Log