Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gomes_T_
Beginner
206 Views

Intel C++ 2016: Constructor and Destructor in unnamed union will be called.

class Optional{
public:
  union {
    Value m_value; ///< should be uninitialized ! But Intel Compiler will Constructor and Destructor here!
  };
};

Intel C++ 2016 will call Constructor and Destructor for the class inside unnamed union.

But this should be deleted and like VS2015 compiler it would be great to get a message about this.

0 Kudos
6 Replies
Gomes_T_
Beginner
206 Views

Here is VS 2015  compiler message:

destructor was implicitly defined as deleted because a base class destructor is inaccessible or deleted

JenniferJ
Moderator
206 Views

how is the "Value" type defined? can you post the definition here?

Jennifer

Gomes_T_
Beginner
206 Views

Thanks for answer. Actually Value can be any type because it was a template parameter. But for testing here is the example: https://gist.github.com/DevO2012/e3e1f011b890e0ae7ff6 This is strange but in this test Destructor will not be called, only Constructor will be called . Any way something is totally broken here.
JenniferJ
Moderator
206 Views

Ok. Thanks for the full test.

I've just filed a bug DPD200369174 to the C++ Front End team.

Jennifer

JenniferJ
Moderator
206 Views

An update about this issue. The run-time error that Intel Compiler generated code calls Value's constructor is fixed already. The fix will be in the coming 16.0 beta update 1 release.

As for the diagnostic msg, icl won't emit any just like g++ 4.8 or later. It doesn't make sense to have a "warning" here.

Please watch for the email notification about the update 1 from Intel Premier Support.

thanks,

Jennifer

Gomes_T_
Beginner
206 Views

Thanks, it appears to be fixed in 16.0 Beta update 1.
Reply