C+11 doesn't seem to work well with VM or I missed setting some option somewhere.
In the Arduino IDE I went to platform.txt and added -std=gnu++11 to compiler.cpp.flags
Now it recognizes this:
Quote:constexpr int get_five()
{
return 5;
}
This option appears to be read by Visual Micro too because I don't need to add it seperately in the command line options. VM behaves weirdly though.
Although it appears to compile, the constexpr keyword is marked as red with "error: this expression has no storage or class type specifier"
Something similar happens with ranges (similar to for each in other languages):
Quote:
int my_array[5] = {1, 2, 3, 4, 5};
for (int &x : my_array)
{
x *= 2;
}
This gives "error: references variable 'x' requires an initializer" in the editor, but again it compilers and it works correctly.
On the other hand, other features work fine. For example the nullptr constant or the auto keyword. That's all I tried though.
Do I need to set some switch in VM too or is this something that's just not supported right now?