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 bug in Visual Studio?
UPDATE
Based on the comments and answers here I have opened a bug report on Microsoft Connect.
This is an Intellisense bug. Both clang and gcc accept this code, also webcompiler an online Visual c++ compiler accepts this code.
The draft C++14 standard section
12.1
[class.ctor] says a defaulted default constructor for a class is deleted if:none of which applies here.
Update
In the bug report filed by the OP the response was: