- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 {
public:
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?
Regards
Benoit Sevigny
Kaydara Inc.
class foo {
public:
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?
Regards
Benoit Sevigny
Kaydara Inc.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Ganesh
You can force the compiler to make this a warning by issueing the /Qww
/Qww
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.
Ganesh
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page