Muokkaa

Jaa


Microsoft C/C++ compiler warnings C4200 through C4399

The articles in this section describe Microsoft C/C++ compiler warning messages C4200 through C4399.

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 2 and level 4) C4200 nonstandard extension used: zero-sized array in struct/union
Compiler warning (level 4) C4201 nonstandard extension used: nameless struct/union
Compiler warning (level 4) C4202 nonstandard extension used: '...': prototype parameter in name list illegal
Compiler warning C4203 nonstandard extension used: union with static member variable
Compiler warning (level 4) C4204 nonstandard extension used: non-constant aggregate initializer
Compiler warning (level 4) C4205 nonstandard extension used: static function declaration in function scope
Compiler warning (level 4) C4206 nonstandard extension used: translation unit is empty
Compiler warning (level 4) C4207 nonstandard extension used: extended initializer form
Compiler warning (level 4) C4208 nonstandard extension used: delete [exp] - exp evaluated but ignored
Compiler warning (level 4) C4210 nonstandard extension used: function given file scope
Compiler warning (level 4) C4211 nonstandard extension used: redefined extern to static
Compiler warning (level 4) C4212 nonstandard extension used: function declaration used ellipsis
Compiler warning (level 4) C4213 nonstandard extension used: cast on l-value
Compiler warning (level 4) C4214 nonstandard extension used: bit field types other than int
Compiler warning (level 1) C4215 nonstandard extension used: long float
Compiler warning (level 1) C4216 nonstandard extension used: float long
Compiler warning (level 4) C4218 nonstandard extension used: must specify at least a storage class or a type
Compiler warning (level 4) C4220 varargs matches remaining parameters
Compiler warning (level 4) C4221 nonstandard extension used: 'identifier': cannot be initialized using address of automatic variable 'variable'
Compiler warning (level 1 and level 4) C4223 nonstandard extension used: non-lvalue array converted to pointer
Compiler warning (level 1) C4224 nonstandard extension used: formal parameter 'identifier' was previously defined as a type
Compiler warning (level 1, Error) C4226 nonstandard extension used: 'keyword' is an obsolete keyword
Compiler warning (level 1) C4227 anachronism used: qualifiers on reference are ignored
Compiler warning (level 1) C4228 nonstandard extension used: qualifiers after comma in declarator list are ignored
Compiler warning (level 1, Error) C4229 anachronism used: modifiers on data are ignored
Compiler warning (level 1) C4230 anachronism used: modifiers/qualifiers interspersed; qualifier ignored
Compiler warning (level 4) C4232 nonstandard extension used: 'identifier': address of dllimport 'dllimport' is not static, identity not guaranteed
Compiler warning (level 1, Error) C4233 nonstandard extension used: 'keyword' keyword only supported in C++, not C
Compiler warning (level 4, Error) C4234 nonstandard extension used: 'keyword' keyword reserved for future use
Compiler warning (level 1, Error) C4235 nonstandard extension used: 'keyword' keyword not supported on this architecture
Compiler warning (level 1) C4237 'keyword' keyword is not yet supported, but reserved for future use
Compiler warning (level 4) C4238 nonstandard extension used: class rvalue used as lvalue
Compiler warning (level 4) C4239 nonstandard extension used: 'token': conversion from 'type1' to 'type2'
Compiler warning (level 3) C4240 nonstandard extension used: access to 'classname' now defined to be 'access_specifier1', previously it was defined to be 'access_specifier2'
Compiler warning (level 3, off) C4242 'identifier': conversion from 'type1' to 'type2', possible loss of data
Compiler warning (level 3) C4243 conversion_type conversion from 'type1' to 'type2' exists, but is inaccessible
Compiler warning (level 2) C4244 'conversion_type': conversion from 'type1' to 'type2', possible loss of data
Compiler warning (level 2 and level 3 and level 4) C4244 'conversion_type': conversion from 'type1' to 'type2', possible loss of data
Compiler warning (level 4) C4245 'conversion_type': conversion from 'type1' to 'type2', signed/unsigned mismatch
Compiler warning (level 2) C4250 'classname': inherits 'base_classname::member' via dominance
Compiler warning (level 2) C4251 'object_type1': 'identifier1' needs to have dll-interface to be used by clients of 'identfier2'
Compiler warning (level 4, off) C4254 'operator': conversion from 'type1':'field_bits' to 'type2':'field_bits', possible loss of data
Compiler warning (level 4, off) C4255 'function': no function prototype given: converting '()' to '(void)'
Compiler warning (level 4) C4256 'function': constructor for class with virtual bases has '...'; calls may not be compatible with older versions of Visual C++
Compiler warning (level 1) C4258 'variable': definition from the for loop is ignored; the definition from the enclosing scope is used
Compiler warning (level 4, off) C4263 'function': member function does not override any base class virtual member function
Compiler warning (level 4, off) C4264 'virtual_function': no override available for virtual member function from base 'classname'; function is hidden
Compiler warning (level 3, off) C4265 'classname': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly
Compiler warning (level 4, off) C4266 'virtual_function': no override available for virtual member function from base 'classname'; function is hidden
Compiler warning (level 3) C4267 'variable': conversion from 'size_t' to 'type', possible loss of data
Compiler warning (level 4) C4268 'identifier': 'const' static/global data initialized with compiler generated default constructor fills the object with zeros
Compiler warning (level 1) C4269 'identifier': 'const' automatic data initialized with compiler generated default constructor produces unreliable results
Compiler warning (level 1) C4272 'function': is marked __declspec(dllimport); must specify native calling convention when importing a function.
Compiler warning (level 1) C4273 'function': inconsistent dll linkage
Compiler warning (level 1) C4274 #ident ignored; see documentation for #pragma comment(exestr, 'string')
Compiler warning (level 2) C4275 non dll-interface classkey 'identifier1' used as base for dll-interface classkey 'identifier2'
Compiler warning (level 1) C4276 'function': no prototype provided; assumed no parameters
Compiler warning (level 1) C4277 imported item 'classname::member' exists as both data member and function member; data member ignored
Compiler warning (level 3 and level 4) C4278 'identifier': identifier in type library 'library' is already a macro; use the 'rename' qualifier
Compiler warning (level 3 and level 4) C4279 'identifier': identifier in type library 'library' is a keyword; use the 'rename' qualifier
Compiler warning (level 3) C4280 'operator ->' was self recursive through type 'type'
Compiler warning (level 3) C4281 'operator ->' recursion occurred through type 'type1'
Compiler warning (level 3) C4282 then through type 'type2'
Compiler warning (level 3) C4283 and through type 'typeN'
Compiler warning (level 2) C4285 return type for 'identifier::operator ->' is recursive if applied using infix notation
Compiler warning (level 1) C4286 'derived_type': is caught by base class ('base_type') on line line_number
Compiler warning (level 3, off) C4287 'operator': unsigned/negative constant mismatch
Compiler warning (level 1) C4288 nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope
Compiler warning (level 4, off) C4289 nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
Compiler warning (level 3) C4290 C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
Compiler warning (level 1) C4291 'declaration': no matching operator delete found; memory will not be freed if initialization throws an exception
Compiler warning (level 1) C4293 'shift_operator': shift count negative or too big, undefined behavior
Compiler warning (level 4) C4295 'array': array is too small to include a terminating null character
Compiler warning (level 4, off) C4296 'operator': expression is always boolean_value
Compiler warning (level 1) C4297 'function': function assumed not to throw an exception but does
Compiler warning (level 4) C4298 'identifier': identifier in type library 'library' is already a macro; renaming to '__identifier'
Compiler warning (level 4) C4299 'identifier': identifier in type library 'library' is a keyword; renaming to '__identifier'
Compiler warning C4301 'derived_class::function': overriding virtual function only differs from 'base_class::function' by const/volatile qualifier
Compiler warning (level 2) C4302 'conversion': truncation from 'type1' to 'type2'
Compiler warning (no longer emitted) C4303 C-style cast from 'type1' to 'type2' is deprecated, use static_cast, __try_cast or dynamic_cast
Compiler warning (level 1 and level 2 and level 4) C4305 'conversion': truncation from 'type1' to 'type2'
Compiler warning (level 4) C4306 'conversion': conversion from 'type1' to 'type2' of greater size
Compiler warning (level 2) C4307 'operator': signed integral constant overflow
Compiler warning (level 2) C4308 negative integral constant converted to unsigned type
Compiler warning (level 2) C4309 'conversion': truncation of constant value
Compiler warning (level 4) C4310 cast truncates constant value
Compiler warning (level 1) C4311 'variable': pointer truncation from 'type1' to 'type2'
Compiler warning (level 1) C4312 'operation': conversion from 'type1' to 'type2' of greater size
Compiler warning (level 1) C4313 'function': '%format_specifier' in format string conflicts with argument argument_number of type 'type'
Compiler warning C4314 expected pragma parameter to be '32' or '64'
Compiler warning (level 4) C4315 'classname': 'this' pointer for member 'member' may not be aligned alignment as expected by the constructor
Compiler warning (level 3) C4316 'identifier': object allocated on the heap may not be aligned alignment
Compiler warning (level 1) C4317 'printf_family' : not enough arguments passed for format string
Compiler warning C4318 passing constant zero as the length to memset
Compiler warning (level 1) C4319 'operator': zero extending 'type1' to 'type2' of greater size
Compiler warning (level 1) C4321 automatically generating an IID for interface 'interface'
Compiler warning (level 1) C4322 automatically generating a CLSID for class 'class'
Compiler warning (level 1) C4323 re-using registered CLSID for class 'class'
Compiler warning (level 4) C4324 'structname': structure was padded due to alignment specifier
Compiler warning (level 1) C4325 attributes for standard section 'section' ignored
Compiler warning (level 1) C4326 return type of 'function' should be 'type1' instead of 'type2'
Compiler warning C4327 'assignment': indirection alignment of LHS ('alignment1') is greater than RHS ('alignment2')
Compiler warning C4328 'function': indirection alignment of formal parameter parameter_number (parameter_alignment) is greater than the actual argument alignment (argument_alignment)
Compiler warning (level 1) C4329 alignment specifier is ignored on enum
Compiler warning (level 1) C4330 attribute 'attribute' for section 'section' ignored
Compiler warning (level 1) C4333 'shift_operator': right shift by too large amount, data loss
Compiler warning (level 3) C4334 'shift_operator': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
Compiler warning (level 1) C4335 Mac file format detected: please convert the source file to either DOS or UNIX format
Compiler warning (level 4) C4336 import cross-referenced type library 'library1' before importing 'library2'
Compiler warning (level 4) C4337 cross-referenced type library 'library1' in 'library2' is being automatically imported
Compiler warning (level 4) C4338 #pragma directive: standard section 'section' is used
Compiler warning (level 4, off) C4339 'type': use of undefined type detected in 'WinRT|CLR' meta-data - use of this type may lead to a runtime exception
Compiler warning (level 1) C4340 'value': value wrapped from positive to negative value
Compiler warning (level 1, off, no longer emitted) C4342 behavior change: 'function' called, but a member operator was called in previous versions
Compiler warning (level 4) C4343 #pragma optimize("g",off) overrides /Og option
Compiler warning (level 1) C4344 behavior change: use of explicit template arguments results in call to 'function'
Compiler warning (level 1) C4346 'name': dependent name is not a type
Compiler warning (level 1) C4348 'type': redefinition of default parameter: parameter parameter_number
Compiler warning (level 1, off, no longer emitted) C4350 behavior change: 'member1' called instead of 'member2'
Compiler warning (level 1) C4352 'identifier': intrinsic function already defined
Compiler warning (level 1) C4353 nonstandard extension used: constant 0 as function expression. Use '__noop' function intrinsic instead
Compiler warning (level 1 and level 4, off) C4355Compiler warning (level 1 and level 4) C4355 'this': used in base member initializer list
Compiler warning (level 2) C4356 'member': static data member cannot be initialized via derived class
Compiler warning (level 3) C4357 param array argument found in formal argument list for delegate 'delegate' ignored when generating 'function'
Compiler warning (level 1) C4358 'operator': return type of combined delegates is not 'void'; returned value is undefined
Compiler warning (level 1 and level 3) C4359 'type': Alignment specifier is less than actual alignment (alignment), and will be ignored.
Compiler warning (level 2) C4362 'type': alignment greater than 8 bytes is not supported by CLR
Compiler warning (level 1) C4364 #using for assembly 'assembly' previously seen at location(line_number) without as_friend attribute; as_friend not applied
Compiler warning (level 4, off) C4365 'expression': conversion from 'type1' to 'type2', signed/unsigned mismatch
Compiler warning (level 4) C4366 The result of the unary 'operator' operator may be unaligned
Compiler warning (level 3) C4367 Conversion from 'type1' to 'type2' may cause datatype misalignment exception
Compiler warning (level 1, Error) C4368 cannot define 'member' as a member of managed 'type': mixed types are not supported
Compiler warning (level 1) C4369 'enumerator': enumerator value 'value' cannot be represented as 'type', value is 'new_value'
Compiler warning (level 4, no longer emitted) C4370 'classname': layout of class has changed from a previous version of the compiler due to better packing
Compiler warning (level 3, off) C4371 'classname': layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
Compiler warning (level 4) C4373 'function': virtual function overrides 'base_class_function', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
Compiler warning (level 1) C4374 'function1': interface method will not be implemented by non-virtual method 'function2'
Compiler warning (level 1) C4375 non-public method 'method2' does not override 'method2'
Compiler warning (level 1) C4376 access specifier 'specifier1 specifier2:' is no longer supported: please use 'new_specifier:' instead
Compiler warning (level 1) C4377 native types are private by default; -d1PrivateNativeTypes is deprecated
Compiler warning (level 1) C4378 Must obtain function pointers to run initializers; consider System::ModuleHandle::ResolveMethodHandle
Compiler warning (level 1) C4379 Version 'version_number' of the common language runtime is not supported by this compiler. Using this version may cause unexpected results
Compiler warning (level 1, Error) C4380 'class': A default constructor cannot be deprecated
Compiler warning (level 1) C4381 'function1': interface method will not be implemented by non-public method 'function2'
Compiler warning (level 1) C4382 throwing 'type': a type with __clrcall destructor or copy constructor can only be caught in /clr:pure module
Compiler warning (level 1) C4383 'instance_dereference_operator': the meaning of dereferencing a handle can change, when a user-defined 'instance_dereference_operator' operator exists; write the operator as a static function to be explicit about the operand
Compiler warning (level 1) C4384 #pragma 'pragma_name' should only be used at global scope
Compiler warning (level 3) C4387 'alternative': was considered
Compiler warning (level 4, off) C4388) 'expression': signed/unsigned mismatch
Compiler warning (level 4) C4389 'operator': signed/unsigned mismatch
Compiler warning (level 3) C4390 ';': empty controlled statement found; is this the intent?
Compiler warning (level 1) C4391 'function_signature': incorrect return type for intrinsic function, expected 'type'
Compiler warning (level 1, Error) C4392 'function_signature': incorrect number of arguments for intrinsic function, expected 'argument_count' arguments
Compiler warning (level 1) C4393 'variable': const has no effect on literal data member; ignored
Compiler warning (level 1, Error) C4394 'function': per-appdomain symbol should not be marked with __declspec(dllexport)
Compiler warning (level 1) C4395 'function': member function will be invoked on a copy of the initonly data member 'member'
Compiler warning (level 2) C4396 'function': the inline specifier cannot be used when a friend declaration refers to a specialization of a function template
Compiler warning (level 1) C4397 DefaultCharSetAttribute is ignored
Compiler warning (level 3) C4398 'variable': per-process global object might not work correctly with multiple appdomains; consider using __declspec(appdomain)
Compiler warning (level 1, Error) C4399 'symbol': per-process symbol should not be marked with __declspec(dllimport) when compiled with /clr:pure

See also

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