Edit

Share via


Microsoft C/C++ compiler warnings C4800 through C4999

The articles in this section describe Microsoft C/C++ compiler warning messages C4800-C4999.

Important

The Visual Studio compilers and build tools can report many kinds of errors and warnings. After an error or warning is found, the build tools may make assumptions about code intent and attempt to continue, so that more issues can be reported at the same time. If the tools make the wrong assumption, later errors or warnings may not apply to your project. When you correct issues in your project, always start with the first error or warning that's reported, and rebuild often. One fix may make many subsequent errors go away.

To get help on a particular diagnostic message in Visual Studio, select it in the Output window and press the F1 key. Visual Studio opens the documentation page for that error, if one exists. You can also use the search tool at the top of the page to find articles about specific errors or warnings. Or, browse the list of errors and warnings by tool and type in the table of contents on this page.

Note

Not every Visual Studio error or warning is documented. In many cases, the diagnostic message provides all of the information that's available. If you landed on this page when you used F1 and you think the error or warning message needs additional explanation, let us know. You can use the feedback buttons on this page to raise a documentation issue on GitHub. If you think the error or warning is wrong, or you've found another problem with the toolset, report a product issue on the Developer Community site. You can also send feedback and enter bugs within the IDE. In Visual Studio, go to the menu bar and choose Help > Send Feedback > Report a Problem, or submit a suggestion by using Help > Send Feedback > Send a Suggestion. Some compiler error topics were created that are not emitted by the compiler and now redirect to this page instead.

You may find additional assistance for errors and warnings in Microsoft Learn Q&A forums. Or, search for the error or warning number on the Visual Studio C++ Developer Community site. You can also search Stack Overflow to find solutions.

For links to additional help and community resources, see Visual C++ Help and Community.

Warning messages

Warning Message
Compiler warning (level 4, off) C4800 Implicit conversion from 'type' to bool. Possible information loss
Compiler warning C4801 Return by reference is not verifiable: message
Compiler warning (level 1) C4803 'method': the raise method has a different storage class from that of the event, 'event'
Compiler warning (level 1) C4804 'operation': unsafe use of type 'bool' in operation
Compiler warning (level 1) C4805 'operation': unsafe mix of type 'type1' and type 'type2' in operation
Compiler warning (level 1) C4806 'operation': unsafe operation: no value of type 'type1' promoted to type 'type2' can equal the given constant
Compiler warning (level 1) C4807 'operation': unsafe mix of type 'type1' and signed bit field of type 'type2'
Compiler warning (level 1) C4808 case 'value' is not a valid value for switch condition of type 'bool'
Compiler warning (level 1) C4809 switch statement has redundant 'default' label; all possible 'case' labels are given
Compiler warning (level 1) C4810 value of pragma pack(show) == n
Compiler warning (level 1) C4811 value of pragma conform(forScope, show) == value
Compiler warning (level 1) C4812 obsolete declaration style: please use 'new_syntax' instead
Compiler warning (level 1) C4813 'function': a friend function of a local class must have been previously declared
Compiler warning (level 4) C4815 'object name': zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)
Compiler warning (level 4) C4816 'param': parameter has a zero-sized array which will be truncated (unless the object is passed by reference)
Compiler warning (level 1) C4817 'member': illegal use of '.' to access this member; compiler replaced with '->'
Compiler warning (level 1) C4819 The file contains a character that cannot be represented in the current code page (number). Save the file in Unicode format to prevent data loss
Compiler warning (level 4, off) C4820 'bytes' bytes padding added after construct 'member_name'
Compiler warning (level 1) C4821 Unable to determine Unicode encoding type, please save the file with signature (BOM)
Compiler warning (level 1, off) C4822 'member function': local class member function does not have a body
Compiler warning (level 3) C4823 'function': uses pinning pointers but unwind semantics are not enabled. Consider using /EHa
Compiler warning (level 2, off) C4826 Conversion from 'type1' to 'type2' is sign-extended. This may cause unexpected runtime behavior.
Compiler warning (level 3) C4827 A public 'ToString' method with 0 parameters should be marked as virtual and override
Compiler warning (level 1) C4828 The file contains a character starting at offset 0xHexOffset that is illegal in the current source character set (codepage codepage).
Compiler warning (level 1) C4829 Possibly incorrect parameters to function main. Consider 'int main(Platform::Array<Platform::String^>^ argv)'
Compiler warning (level 1) C4834 discarding return value of function with 'nodiscard' attribute
Compiler warning (level 1) C4835 'variable': the initializer for exported data will not be run until managed code is first executed in the host assembly
Compiler warning (level 4, off) C4837 trigraph detected: '??character' replaced by 'character'
Compiler warning (level 1) C4838 conversion from 'type_1' to 'type_2' requires a narrowing conversion
Compiler warning (level 3) C4839 non-standard use of class 'type' as an argument to a variadic function
Compiler warning (level 4) C4840 non-portable use of class 'type' as an argument to a variadic function
Compiler warning (level 4, off) C4841 non-standard extension used: compound member designator used in offsetof
Compiler warning (level 4, off) C4842 the result of 'offsetof' applied to a type using multiple inheritance is not guaranteed to be consistent between compiler releases
Compiler warning (level 4) C4843 'type1': An exception handler of reference to array or function type is unreachable, use 'type2' instead
Compiler warning (level 1) C4844 'export module module_name;' is now the preferred syntax for declaring a module interface
Compiler warning (level 4) C4845 '__declspec(no_init_all)' is ignored if '/d1initall[0|1|2|3]' was not specified on the command line
Compiler warning (level 4) C4846 'value' is not a valid argument for '/d1initall': command-line flag ignored
Compiler warning (level 4) C4847 '__declspec(no_init_all)' can only be applied to a function, a class type, or a local variable: ignored
Compiler warning (level 1) C4848 support for standard attribute 'no_unique_address' in C++17 and earlier is a vendor extension
Compiler warning (level 1) C4849 OpenMP 'clause' clause ignored in 'directive' directive
Compiler warning (Level 1, error) C4854 binding dereferenced null pointer to reference has undefined behavior
Compiler warning (level 1, off) C4855 implicit capture of 'this' via '[=]' is deprecated in 'version'
Compiler warning (level 4) C4856 'value' is not a valid argument for '/d1initAll:FillPattern' (value must be between 0 and 255). Command-line flag ignored
Compiler warning (level 1) C4857 C++/CLI mode does not support C++ versions newer than C++17; setting language to /std:c++17
Compiler warning (level 1) C4858 discarding return value: function name
Compiler warning (level 4) C4859 'value' is not a valid argument for '/presetWarn': it must be a decimal value > 0. Command-line flag ignored
Compiler warning (level 4) C4860 'object name': compiler zero initialized 'number' bytes of storage
Compiler warning (level 4) C4861 compiler zero initialized 'number' bytes of storage
Compiler warning (level 4) C4866 compiler may not enforce left-to-right evaluation order for call to operator_name
Compiler warning (level 1, error) C4867 'function': function call missing argument list; use 'call' to create a pointer to member
Compiler warning (level 4) C4868 'file(line_number)' compiler may not enforce left-to-right evaluation order in braced initialization list
Compiler warning (level 3) C4869 'nodiscard' may only be applied to classes, enumerations, and functions
Compiler warning (level 2) C4872 floating point division by zero detected when compiling the call graph for the concurrency::parallel_for_each at: 'location'
Compiler warning (level 1) C4880 casting from 'const type_1' to 'type_2': casting away constness from a pointer or reference may result in undefined behavior in an amp restricted function
Compiler warning (level 4) C4881 the constructor and/or the destructor will not be invoked for tile_static variable 'variable-name'
Compiler warning (level 1) C4882 passing functors with non-const call operators to concurrency::parallel_for_each is deprecated
Compiler warning C4883 'function name': function size suppresses optimizations
Compiler warning C4900 Il mismatch between 'tool1' version 'version1' and 'tool2' version 'version2'
Compiler warning (level 1, off) C4905 wide string literal cast to 'LPSTR'
Compiler warning (level 1, off) C4906 string literal cast to 'LPWSTR'
Compiler warning (Error) C4907 multiple calling conventions cannot be specified; last given will be used
Compiler warning (level 1) C4910 '<identifier>: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
Compiler warning (level 1) C4912 'attribute': attribute has undefined behavior on a nested UDT
Compiler warning (level 4) C4913 user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used
Compiler warning (level 1) C4916 in order to have a dispid, 'description': must be introduced by an interface
Compiler warning (level 1, off) C4917 'declarator': a GUID can only be associated with a class, interface or namespace
Compiler warning (level 4) C4918 'character': invalid character in pragma optimization list
Compiler warning (level 1) C4920 enum enum-name member member_1=value_1 already seen in enum enum-name as member_2=value_2
Compiler warning (level 3) C4921 'description': attribute value 'attribute' should not be multiply specified
Compiler warning (level 1) C4925 'method': dispinterface method cannot be called from script
Compiler warning (level 1) C4926 'identifier': symbol is already defined: attributes ignored
Compiler warning (level 1) C4927 illegal conversion; more than one user-defined conversion has been implicitly applied
Compiler warning (level 1, off) C4928 illegal copy-initialization; more than one user-defined conversion has been implicitly applied
Compiler warning (level 1) C4929 'file': typelibrary contains a union; ignoring the 'embedded_idl' qualifier
Compiler warning (level 1) C4930 'prototype': prototyped function not called (was a variable definition intended?)
Compiler warning (level 4, off) C4931 we are assuming the type library was built for number-bit pointers
Compiler warning (level 4) C4932 __identifier(identifier) and __identifier(identifier) are indistinguishable
Compiler warning (level 1) C4934 '__delegate(multicast)' is deprecated, use '__delegate' instead
Compiler warning (level 1) C4935 assembly access specifier modified from 'access'
Compiler warning (level 1, Error) C4936 this __declspec is supported only when compiled with /clr or /clr:pure
Compiler warning (level 4) C4937 'text1' and 'text2' are indistinguishable as arguments to 'directive'
Compiler warning (level 4) C4938 'var': Floating point reduction variable may cause inconsistent results under /fp:strict or #pragma fenv_access
Compiler warning C4939 #pragma vtordisp is deprecated and will be removed in a future release of Visual C++
Compiler warning (level 1) C4944 'symbol': cannot import symbol from 'assembly1': as 'symbol' already exists in the current scope
Compiler warning (level 1) C4945 'symbol': cannot import symbol from 'assembly1': as 'symbol' has already been imported from another assembly 'assembly2'
Compiler warning (level 1, off) C4946 reinterpret_cast used between related classes: 'class1' and 'class2'
Compiler warning (level 1) C4947 'type_or_member': marked as obsolete
Compiler warning (level 2) C4948 return type of 'accessor' does not match the last parameter type of the corresponding setter
Compiler warning (level 1 and level 4) C4949 pragmas 'managed' and 'unmanaged' are meaningful only when compiled with '/clr[:option]'
Compiler warning (level 1, Error) C4950 'type_or_member': marked as obsolete
Compiler warning (level 1) C4951 'function' has been edited since profile data was collected, function profile data not used
Compiler warning (level 1) C4952 'function': no profile data found in program database 'pgd-file'
Compiler warning (level 1) C4953 Inlinee 'function' has been edited since profile data was collected, profile data not used
Compiler warning C4954 'function': not profiled (contains __int64 switch expression)
Compiler warning C4955 'import2': import ignored; already imported from 'import1'
Compiler warning (level 1, Error) C4956 'type': this type is not verifiable
Compiler warning (level 1, Error) C4957 'cast': explicit cast from 'cast_from' to 'cast_to' is not verifiable
Compiler warning (level 1, Error) C4958 'operation': pointer arithmetic is not verifiable
Compiler warning (level 1, Error) C4959 cannot define unmanaged type 'type' in /clr:safe because accessing its members yields unverifiable code
Compiler warning (level 4) C4960 'function' is too big to be profiled
Compiler warning (level 1) C4961 No profile data was merged into 'pgd-file', profile-guided optimizations disabled
Compiler warning (level 4, off) C4962 'function': Profile-guided optimizations disabled because optimizations caused profile data to become inconsistent
Compiler warning (level 1) C4963 'description': no profile data found; different compiler options were used in instrumented build
Compiler warning (level 1) C4964 No optimization options were specified; profile info will not be collected
Compiler warning (level 1) C4965 implicit box of integer 0; use nullptr or explicit cast
Compiler warning (level 1) C4966 'function' has __code_seg annotation with unsupported segment name, annotation ignored
Compiler warning C4970 delegate constructor: target object ignored since 'type' is static
Compiler warning (level 1) C4971 Argument order: <target object>, <target function> for delegate constructor is deprecated, use <target function>, <target object="">
Compiler warning (level 1, Error) C4972 Directly modifying or treating the result of an unbox operation as an lvalue is unverifiable
Compiler warning (level 1) C4973 'symbol': marked as deprecated
Compiler warning (level 1) C4974 'symbol': marked as deprecated
Compiler warning (level 1) C4975 modopt '[modifier]' was ignored for formal parameter 'parameter'
Compiler warning (level 1) C4976 invalid value 'value' for '/W'; assuming '1'
Compiler warning (level 3) C4981 Warbird: function 'function' marked as __forceinline not inlined because it contains exception semantics
Compiler warning (level 3) C4983 '/analyze:sarif:hashname' ignored because the argument to '/analyze:log' is a single file rather than a directory
Compiler warning C4984 'if constexpr' is a C++17 language extension
Compiler warning (level 4) C4985 'symbol_name': attributes not present on previous declaration.
Compiler warning (level 4, off) C4986 'declaration': exception specification does not match previous declaration
Compiler warning (level 4, off) C4987 nonstandard extension used: 'throw (...)'
Compiler warning (level 4, off) C4988 'variable': variable declared outside class/function scope
Compiler warning (level 4) C4989 'type': type has conflicting definitions.
Compiler warning (level 3) C4990 Warbird: message
Compiler warning (level 3) C4991 Warbird: function 'function' marked as __forceinline not inlined because protection level of inlinee is greater than the parent
Compiler warning (level 3) C4992 Warbird: function 'function-name' marked as __forceinline not inlined because it contains inline assembly which cannot be protected
Compiler warning (level 3) C4995 'function': name was marked as #pragma deprecated
Compiler warning (level 3) C4996 'deprecated-declaration': deprecation-message (or "was declared deprecated")
Compiler warning (level 1) C4997 'class': coclass does not implement a COM interface or pseudo-interface
Compiler warning (level 1) C4998 EXPECTATION FAILED: expectation(value)

See also

C/C++ Compiler and build tools errors and warnings
Compiler warnings C4000 - C5999