Other Parts Discussed in Thread: TM4C1294NCPDT
Tool/software: TI C/C++ Compiler
I am trying new c++ features not supported with the previous compiler and found and issue that I would like to ask about. The snippet is taken from Josuttis' "The C++ Standard Library", 2nd edition:
#include <iostream>
using namespace std;
int main( void )
{
int x = 0, y = 42;
auto qqq = [x, &y]
{
cout << "x: " << x << endl;
cout << "y: " << y << endl;
++y;
};
x = y = 77;
qqq();
qqq();
cout << "Final y: " << y << endl;
}
It compiles properly, but when I try to debug it I get:
The project configuration is sane though, I can run it by removing the lambda and the local variables from main() and not using any capture argument:
#include <iostream>
using namespace std;
int x = 0, y = 42;
auto qqq = []
{
cout << "x: " << x << endl;
cout << "y: " << y << endl;
++y;
};
int main( void )
{
x = y = 77;
qqq();
qqq();
cout << "Final y: " << y << endl;
}
Gives:
Since the book is post c++11, is this something that changed with c++14?
Thank you,
Pibe



