eggs-cpp / variant

Eggs.Variant is a C++11/14/17 generic, type-safe, discriminated union.
http://eggs-cpp.github.io/variant/
Boost Software License 1.0
138 stars 27 forks source link

Compiling error VS 2015 Update 3 #29

Closed erakis closed 6 years ago

erakis commented 6 years ago

Hi,

I'm using Visual Studio 2015 Update 3 and I'm getting this error. I use the commit 91dae8040425e51aab24d25788336063e1c6837e

image

Commenting this line (28) make the compilation succeed.

K-ballo commented 6 years ago

Hi @purell,

I cannot reproduce this on master using Visual Studio 2015 Update 3. Could you provide me with detailed steps to reproduce the issue?

From the screenshot, it looks like it is not a build error but rather an IntelliSense error.

erakis commented 6 years ago

@K-ballo You are right, it's an Intellisense error. Thank you for your time.

I'm coming from VS 2008 and Intellisense worked much better than on 2015. I'm always getting weird error or a message saying that Intellisens has not finished parsing and sometime it never end so I don't know why I'm still using VS as Notepad++ can do the same if I can't get Intellisense working well as before ;)

Anyway, do you know why I'm getting this Intellisense error ? Do you get it too ? It's a fresh installation without any plugins or extension installed. My exact version is Visual Studio Professional 2015 Version 14.0.25431.01 Update 3

K-ballo commented 6 years ago

@purell I do not, I am not able to reproduce the error. My exact version is too 14.0.25431.01 Update 3. My steps are create a new empty project, configure additional include directories, add a new source file, and finally #include <eggs/variant.hpp>, then build (successfully).

What are the detailed steps you make that lead to reproducing this issue?

erakis commented 6 years ago

Sorry for the delay. Your version is the same as mine.

I started a new empty project and I'm getting the same Intellisense error

image

No error on the output pannel

1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1>  ConsoleApplication1.cpp
1>  ConsoleApplication1.vcxproj -> D:\test\ConsoleApplication1\Debug\ConsoleApplication1.exe
1>  ConsoleApplication1.vcxproj -> D:\test\ConsoleApplication1\Debug\ConsoleApplication1.pdb (Full PDB)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
K-ballo commented 6 years ago

Created a new console project, copied the contents of include/ to the project location, then typed the code from your screenshot:

image

Cannot reproduce; the project builds fine, and IntelliSense does not complain.

I'm going to suggest that you ignore the bogus diagnostic, since it's not a real error and there's nothing I can do to try to mitigate it without being able to reproduce it.

erakis commented 6 years ago

@K-ballo The only difference is that I get the eggs-cpp using

git clone https://github.com/eggs-cpp/variant.git

And then configure additional Include Directories as image

But If I'm the only one with this warning, forget it ;)

K-ballo commented 6 years ago

I made a new (fresh) attempt, replicating the clone/include scenario: same results.

erakis commented 6 years ago

Thank you for your time @K-ballo. I reinstall my Visual Studio 2015 but same problem. Just too bad, I'm kind of not lucky with Intellisense 🥇. Conclusion, the problem is on my side so do not bother anymore with that.

erakis commented 6 years ago

Sorry to resurrect this thread but do you have this warning also (at level 4) ?

In file Visitor.hpp(131)

image

K-ballo commented 6 years ago

do you have this warning also (at level 4) ?

I do.

It is trivial to tell the warning is bogus, but if you can figure out a rewrite of that expression that silences the report without changing semantics I will consider it.

erakis commented 6 years ago

Why not ?

    struct destroy
      : visitor<destroy, void(void*)>
    {
        template <typename T>
        static void call(void* ptr)
        {
            (void)ptr;  <--- This
            static_cast<T*>(ptr)->~T();
        }
    };

Doing this silent the warning. I got no warning at all on eggs-variant ;)

K-ballo commented 6 years ago

That looks like an expression with no side effects, which is sometimes warned on. I'll give (void)ptr; a try, as it looks harmless, and see what CI reports.

K-ballo commented 6 years ago

I'll give (void)ptr; a try, as it looks harmless, and see what CI reports.

This is now f801e971d054341430cb91d79aa0bb4d0bf24330 on master.