I have a question, if the following short code is actually valid:
class Foo {
public:
Foo(std::string param,
const std::vector<std::string>& vec = std::vector<std::string>({ "value 1", "value 2" }))
{}
};
This compiles without warning with both gcc and VC++ 2013, but while the gcc compiled program aslo runs fine (on Linux) the VC++ compiled program breaks with a runtime error when the default parameter should be set.
Foo foo("value"); // breaks
Foo foo("test", std::vector<std::string>({ "value", "value1" })); // runs fine
The error when calling Foo foo("value"); is:
File: f:\dd\vctools\crt\crtw32\misc\dbgdel.cpp
Line: 52
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Can anyone hint to what is wrong?