felix icon indicating copy to clipboard operation
felix copied to clipboard

Add designated initialiser support to MSVC toolchain

Open skaller opened this issue 5 years ago • 2 comments

Yeah, one of the primary issues I'm having is that my $HOME\.felix folder (which is C:\Users\ari\.felix) doesn't have a config folder, only a cache folder, so I'm having to wing it in regards to what folder has the configuration files that it's looking for.

In regards to the MSVC error, there's something weird going on in general. If you look a few lines above the error, you'll also see this:

[flx_depchk] C++ Dependency generator FAILED on C:\Users\ari\.felix\cache\text\D\Code\GitHub\felix\src\web\tutopt\sdlgui\gui_01_window_01.cpp

I searched the error earlier and found this. I'm not entirely sure that setting that flag will fix the problem.

Here's part of a response to someone else getting this error:

That said, C++ designated initializers are slightly different than C designated initializers. Designating array elements is not allowed (because the syntax conflicts with lambda declarations), you cannot re-order the initializers from the member declaration order, and you also cannot access nested members in the designator. See https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated_initializers (the note at the bottom). So, your code will fail to parse in C++20 mode.

According to this, designated initialization was added to Visual Studio 2019 in July, which is after the last time that I built Felix. It seems that a more permanent fix might be necessary for compatibility with VS2019/16.1+.

Originally posted by @arabelladonna in https://github.com/felix-lang/felix/issues/149#issuecomment-747187433

skaller avatar Dec 17 '20 05:12 skaller

So I have added this now, in particular /std:c++latest for C++ and /std:c17 for C in the compiler command line. I have no idea if it works.

skaller avatar Dec 17 '20 05:12 skaller

This tentatively seems to be working. I successfully built and ran the SDL test that was throwing the error in question and a different test.

ahribellah avatar Dec 18 '20 17:12 ahribellah