After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763537 - 3.0: MSVC build fails, because doesn't support most of C++14 features
3.0: MSVC build fails, because doesn't support most of C++14 features
Status: RESOLVED FIXED
Product: libsigc++
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsigc++ maintainer(s)
libsigc++ maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-03-12 14:50 UTC by Marcin Kolny (IRC: loganek)
Modified: 2016-12-13 00:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marcin Kolny (IRC: loganek) 2016-03-12 14:50:23 UTC
Since we switched to C++14, we are using some features, which are not supported even by the newest MSVC compiler [1]. So the question is, if we should wait for newer MSVC version with complete C++14 support, or try to workaround this problems?
I think, we shouldn't fix this issues, since sigc++ requires c++14, and user should expect a problems, if use compiler with partial C++14 support. Moreover, it'll probably introduce a lot of mess in the code. 
I'm open to discussion.
Comment 1 Marcin Kolny (IRC: loganek) 2016-03-12 14:53:23 UTC
[1] https://msdn.microsoft.com/en-us/library/hh567368.aspx#cpp14table
Comment 2 Murray Cumming 2016-03-12 15:57:59 UTC
If a better MSVC++ problem will arrive soon, then, yes, let's not bother.

Otherwise, it would be interesting to find out exactly what doesn't work, though I would not expect to find workarounds for everything.

constexpr is not essential for libsigc++, I think.
Comment 3 Marcin Kolny (IRC: loganek) 2016-03-12 16:04:59 UTC
Actually, it's not a problem with using constexpr itself. The problem is that MSVC doesn't support extended constexpr [1].
Ofc. it's probably not the only one issue, I didn't investigated it so much.


[1] https://isocpp.org/wiki/faq/cpp14-language#extended-constexpr
Comment 4 Murray Cumming 2016-03-12 16:13:29 UTC
Which particular use of constexpr doesn't it like in the libsigc++ code?
Comment 5 Marcin Kolny (IRC: loganek) 2016-03-12 16:15:25 UTC
E.g. method tuple_transform_each() in class tuple_transform_each_impl
Comment 6 Murray Cumming 2016-03-12 17:02:25 UTC
What's the actual error message.

I'm sure the constexpr uses in the tuple utilities could be removed, or sometimes replaced with const.
Comment 7 Marcin Kolny (IRC: loganek) 2016-03-12 17:07:35 UTC
(In reply to Murray Cumming from comment #6)
> What's the actual error message.
Typical for this issue: 
  'size': declaration is not allowed in 'constexpr' function body
The same for len in this function.
Comment 8 Murray Cumming 2016-12-11 11:18:39 UTC
Are things any better with the latest version of MSVC? If not, could you show the full error message with the line numbers, please.
Comment 9 Marcin Kolny (IRC: loganek) 2016-12-11 11:32:43 UTC
AFAIK extended constexpr is still not supported with the newest MSVC. I'll take a look at this a bit closer once I have access to windows box (probably next week).
Comment 10 Fan, Chun-wei 2016-12-11 14:18:37 UTC
Hi,

I tried with the latest Visual Studio 2017 RC (hence I updated the projects to 2017 configs), and things seem to build successfully, with all the test programs.  The 2015 compiler built the main DLL, but the tests fail with the constexpr problems.

With blessings, thank you!
Comment 11 Murray Cumming 2016-12-11 16:22:43 UTC
Thanks. Do the tests even run correctly?
Comment 12 Marcin Kolny (IRC: loganek) 2016-12-11 16:29:12 UTC
(In reply to Fan, Chun-wei from comment #10)
> The 2015 compiler built the main DLL, but the tests fail with the
> constexpr problems.
libsigc++ is mostly header-only library, and if a compiler doesn't support extended constexpr, the library is almost unusable. 

I've just looked at the code, and I think we can quite easily port it to older versions of the compilers (that don't support extended constexpr).
We can find a lot of places like that:

constexpr method()
{
  constexpr val = ...;
}

Basically, constexpr variable declarations are forbidden in the basic constexpr methods, but we can easily just copy values to the places where those variables are used. The code will be uglier, but compatible with older compilers.
The question is if we want to do this?
Comment 13 Fan, Chun-wei 2016-12-12 03:35:18 UTC
Hi Murray

(In reply to Murray Cumming from comment #11)
> Thanks. Do the tests even run correctly?

Sorry I should have mentioned, yes they do run correctly.  Replied too fast.

With blessings, thank you!
Comment 14 Murray Cumming 2016-12-12 08:26:30 UTC
Thanks. Would you like to add an MSVC 2017 project in git? Then we can close this bug, I guess.
Comment 15 Fan, Chun-wei 2016-12-13 00:13:02 UTC
Hi Murray,

Actually I updated the 2013 projects to 2017 format (the format is largely the same, just needed to update a few things) few days ago, but I didn't change the directory name of those yet, I will do so after returning from vacation in 2-3 days.

With blessings, and cheers!