RAD Studio
ContentsIndex
PreviousUpNext
W8006: Initializing 'identifier' with 'identifier' (C++)

(Command-line option to suppress warning: -w-bei

You're trying to initialize an enum variable to a different type. 

For example, the following initialization will result in this warning, because 2 is of type int, not type enum count:

enum count zero, one, two x = 2;

It is better programming practice to use an enum identifier instead of a literal integer when assigning to or initializing enum types. 

This is an error, but is reduced to a warning to give existing programs a chance to work.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!