Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

bug report - defaulted constructor

Even_E_
New Contributor I
371 Views

Hello,

I would like to report a bug, I hope it is the right place. I asked on stackoverflow first (see here).

Trying to compile the code below with ICC (VS10 integrated, Composer XE 2013, Win64) return this error:

error #453: protected function "A::A()" (declared at line 10) is not accessible through a "A" pointer or object.

class A

{

protected:

    constexpr A() = default;

    ~A() = default;

    A(const A&) = delete;

};

class B

    : protected A

{

public:

    B() = default;

};

int main()

{

    B b;

}

Modifications that made the code compile :

  • making the ctor of A public
  • removing the deleted copy ctor of A
  • replacing "= default;" by "{}" in the ctor of A
  • replacing "= default;" by " : A() {}" in the ctor of B

Modifications that didn't make the code compile :

  • removing the constexpr
  • changing inheritance of A by B to public and private
  • replacing "= default;" by " {}" in the ctor of B without explicit call to A's ctor

Thank you for your consideration.

0 Kudos
2 Replies
Even_E_
New Contributor I
371 Views

Another solution has been given by Mike Kinghan after I tested Arne Mertz's ideas an reported the results :

It appears that adding a pointless non-static data member in the class is a good workaround :

class A

{

protected:

    constexpr A() = default;

    ~A() = default;

    A(const A&) = delete;

private:

    char placate_intel_compiler_bug = 0;

};

JenniferJ
Moderator
371 Views

Thanks for reporting the issue with a testcase.

This issue has been solved in the 14.0, although the fix is not in the beta or beta update. 14.0 will be released in the near future. An announcement will be posted on the Forum when it is released.

Thanks,

Jennifer

Reply