Creating a struct from an initializer list

After reinstalling my OS and hence the Arduino tools I now have a compilation error which I never used to get and I have not changed any code in this project, it seems to be an issue with creating a struct with an initializer list.

This is the line which is giving the error:

this->options[KANA_SOURCE] = {"Kana Source", ConfigData::ENUM, 0, {"Keyboard", "File"}, 2};

And the error it is giving:

JpSynthMan.cpp: In constructor ‘JpSynthMan::JpSynthManager::JpSynthManager()’:
JpSynthMan.cpp:14: error: expected primary-expression before ‘{’ token
JpSynthMan.cpp:14: error: expected ;' before ‘{’ token JpSynthMan.cpp:150: error: expected }' at end of input

You can look at the complete code on GitHub: UrabeVocalSynth/JpSynthMan.cpp at master · DanNixon/UrabeVocalSynth · GitHub

The struct I am initializing is defined in ConfigDataDef.h and the class in JpSynthMan.h

Anyone have any ideas what the issue is here?

Adding a cast seems to do the job, haven't actually tested on hardware yet but it at least compiles, will update when I can test it.

That isn’t an initialization, it is an assignment as the object is already initialized. Also the solution is not a cast, rather a ‘Compound literal

http://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html:
Usually, the specified type is a structure. Assume that struct foo and structure are declared as shown:

struct foo {int a; char b[2];} structure;
Here is an example of constructing a struct foo with a compound literal:

structure = ((struct foo) {x + y, ‘a’, 0});
This is equivalent to writing the following:

{
struct foo temp = {x + y, ‘a’, 0};
structure = temp;
}