Error #409

Error #409

Before I proceed and upgrade my 4.5 Intel Compiler, I would like to know if the current version still generates an error when compiling the following code:

class foo {
union {
float f;
const int i;
inline foo(float x) : f(x) {}

With 4.5, the compiler aborts with the following message:

error #409: "foo::foo(float)" provides no initializer for: const member "foo::i"

This class declares an anonymous union containing a const member which is initialized indirectly by the other member. This compiles correctly on both GCC 3.2 and Visual C++ 6.0.

Has this been fixed? Otherwise, any hope it can be?


Benoit Sevigny
Kaydara Inc.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

This is a 'soft error'. Meaning, we really believe this is an error (as in arguably not good programming practice and outside of the standards definition) but you have the choice to make this a warning.

You can force the compiler to make this a warning by issueing the /Qww option.
/Qww[,,...] changes the severity of diagnostics L1 through LN to warning
You can also convert it into a remark with /Qwwr or disable it with /Qwd.

You can also add this to your system config file (icl.cfg/icl6.cfg in your compiler bin directory. Please see the users guide for additional info on using the config file) to make this a permanent option for all your compiles.

Having said all that, I believe we made this to be a warning by default since version 6.0. So you could just try the latest version.

Hope that helped.


Leave a Comment

Please sign in to add a comment. Not a member? Join today