samedi 28 novembre 2015

"default constructor cannot be referenced" in Visual Studio 2015

I am facing a really weird error message in Visual Studio 2015. The following stripped down code:

struct A
{
    A(int val = 0)
    :
        x(val)
    {}

    int x = 0;
};

struct B: A
{
    static int y;
};

int B::y = 1;

struct C: B
{

};

int main()
{
    C c;
    return 0;
}

compiles without any problem on Clang. However Visual Studio 2015 IntelliSense gives the following error message:

the default constructor of "C" cannot be referenced -- it is a deleted function

Am I missing something in my code, or this is a true bug in Visual Studio?

Aucun commentaire:

Enregistrer un commentaire