Programming Search⌘K

C++ errors and diagnostics, page 6 of 7

The error codes and warnings of C++, with the message that each one prints and what causes it. This page has 1,208 cards.

A. -Wstrict-prototypes

Clang enables some of the diagnostics that it controls by default. It also controls -Wdeprecated-non-prototype. Clang has 4 messages for this flag.

Code
-Wstrict-prototypes
Severity
warning
Message
a
Message
function
Message
block
Message
in all versions of C

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

The value of the size argument in ‘strncat’ is too large, might lead to a buffer overflow. -Wstrncat-size

Clang enables it by default. Clang has 3 messages for this flag.

Code
-Wstrncat-size
Severity
warning
Message
the value of the size argument in ‘strncat’ is too large, might lead to a buffer overflow
Message
size argument in ‘strncat’ call appears to be size of the source
Message
the value of the size argument to ‘strncat’ is wrong

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Method parameter type. -Wsuper-class-method-mismatch

Clang has 3 messages for this flag.

Code
-Wsuper-class-method-mismatch
Severity
warning
Message
method parameter type
Message
{} does not match super class method parameter type {}
Message
does not match super class method parameter type

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

A group of warnings. -Wsuspicious-memaccess

Clang enables it by default. It also controls -Wdynamic-class-memaccess, -Wmemset-transposed-args, -Wnontrivial-memaccess, -Wsizeof-pointer-memaccess, -Wsuspicious-bzero.

Code
-Wsuspicious-memaccess
Severity
warning

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

… attribute cannot be applied to this declaration. -Wswift-name-attribute

Clang enables it by default. Clang has 23 messages for this flag.

Code
-Wswift-name-attribute
Severity
warning
Message
{} attribute cannot be applied to this declaration
Message
{} attribute cannot be applied to a
Message
function
Message
method
Message
{} attribute argument must be a string literal specifying a Swift function name
Message
{} attribute for getter must not have any parameters besides ‘self:’
Message
{} attribute has invalid identifier for the
Message
base

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Overflow converting case value to switch condition type (… to …). -Wswitch

Clang enables it by default. Clang has 6 messages for this flag.

Code
-Wswitch
Severity
warning
Message
overflow converting case value to switch condition type ({} to {})
Message
enumeration value {} not handled in switch
Message
enumeration values {} and {} not handled in switch
Message
enumeration values {}, {}, and {} not handled in switch
Message
{} enumeration values not handled in switch: {}, {}, {}…
Message
case value not in enumerated type {}

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Mixing ‘target_clones’ specifier mechanisms is permitted for GCC compatibility; use a comma separated sequence of string literals, or a string literal containing a comma-separated list of versions. -Wtarget-clones-mixed-specifiers

Clang enables it by default.

Code
-Wtarget-clones-mixed-specifiers
Severity
warning
Message
mixing ‘target_clones’ specifier mechanisms is permitted for GCC compatibility; use a comma separated sequence of string literals, or a string literal containing a comma-separated list of versions

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Aligning a value. -Wtautological-compare

Clang enables some of the diagnostics that it controls by default. It also controls -Wtautological-bitwise-compare, -Wtautological-constant-compare, -Wtautological-negation-compare, -Wtautological-objc-bool-compare, -Wtautological-overlap-compare, -Wtautological-pointer-compare, -Wtautological-undefined-compare. Clang has 11 messages for this flag.

Code
-Wtautological-compare
Severity
warning
Message
aligning a value
Message
the result of checking whether a value is aligned
Message
a no-op
Message
always true
Message
self-
Message
array
Message
pointer
Message
a constant

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Converting the result of ‘?:’ with integer constants to a boolean always evaluates to ‘true’. -Wtautological-constant-compare

Clang enables it by default. It also controls -Wtautological-constant-out-of-range-compare. Clang has 10 messages for this flag.

Code
-Wtautological-constant-compare
Severity
warning
Message
converting the result of ‘?:’ with integer constants to a boolean always evaluates to ‘true’
Message
converting the result of ‘<<’ to a boolean always evaluates to
Message
false
Message
true
Message
result of comparison of
Message
constant {}
Message
true
Message
false

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Result of comparison of. -Wtautological-constant-out-of-range-compare

Clang enables it by default. Clang has 6 messages for this flag.

Code
-Wtautological-constant-out-of-range-compare
Severity
warning
Message
result of comparison of
Message
constant {}
Message
true
Message
false
Message
expression of type {}
Message
boolean expression

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Comparison of nonnull. -Wtautological-pointer-compare

Clang enables it by default. Clang has 13 messages for this flag.

Code
-Wtautological-pointer-compare
Severity
warning
Message
comparison of nonnull
Message
function call
Message
parameter
Message
not
Message
true
Message
false
Message
comparison of
Message
address of

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to. -Wtautological-undefined-compare

Clang enables it by default. Clang has 6 messages for this flag.

Code
-Wtautological-undefined-compare
Severity
warning
Message
reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to
Message
true
Message
false
Message
‘this’ pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to
Message
true
Message
false

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Result of comparison of. -Wtautological-unsigned-enum-zero-compare

Clang has 5 messages for this flag.

Code
-Wtautological-unsigned-enum-zero-compare
Severity
warning
Message
result of comparison of
Message
{}
Message
unsigned enum expression
Message
unsigned enum expression
Message
{}

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Result of comparison of. -Wtautological-value-range-compare

Clang has 9 messages for this flag.

Code
-Wtautological-value-range-compare
Severity
warning
Message
result of comparison of
Message
{}
Message
{}-bit
Message
signed
Message
unsigned
Message
{}-bit
Message
signed
Message
unsigned

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

… ‘…’ must be acquired before ‘…’. -Wthread-safety-analysis

Clang has 44 messages for this flag.

Code
-Wthread-safety-analysis
Severity
warning
Message
{} ‘{}’ must be acquired before ‘{}’
Message
cycle in acquired_before/after dependencies, starting with ‘{}’
Message
cannot resolve lock expression
Message
acquiring {} ‘{}’ that is already held
Message
did not expect {} ‘{}’ to be managed by ‘{}’
Message
{} ‘{}’ not managed by ‘{}’
Message
expecting {} ‘{}’ to be held at start of each loop
Message
with equal reentrancy depth

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

… attribute requires arguments whose type is annotated with ‘capability’ attribute; type here is …. -Wthread-safety-attributes

Clang has 13 messages for this flag.

Code
-Wthread-safety-attributes
Severity
warning
Message
{} attribute requires arguments whose type is annotated with ‘capability’ attribute; type here is {}
Message
{} attribute can only be applied in a context annotated with ‘capability’ attribute
Message
{} only applies to pointer types; type here is {}
Message
ignoring {} attribute because its argument is invalid
Message
{} attribute without capability arguments refers to ‘this’, but {} isn’t annotated with ‘capability’ or ‘scoped_lockable’ attribute
Message
{} attribute on a
Message
variable
Message
field

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Passing pointer to variable … requires holding …. -Wthread-safety-pointer

Clang has 12 messages for this flag.

Code
-Wthread-safety-pointer
Severity
warning
Message
passing pointer to variable {} requires holding {}
Message
‘{}’
Message
‘{}’ exclusively
Message
returning pointer to variable {} requires holding {}
Message
‘{}’
Message
‘{}’ exclusively
Message
passing pointer {} requires holding {}
Message
‘{}’

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Passing variable … by reference requires holding …. -Wthread-safety-reference

It also controls -Wthread-safety-reference-return. Clang has 6 messages for this flag.

Code
-Wthread-safety-reference
Severity
warning
Message
passing variable {} by reference requires holding {}
Message
‘{}’
Message
‘{}’ exclusively
Message
passing the value that {} points to by reference requires holding {}
Message
‘{}’
Message
‘{}’ exclusively

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

A group of warnings. -Wtype-limits

It also controls -Wtautological-type-limit-compare, -Wtautological-unsigned-char-zero-compare, -Wtautological-unsigned-enum-zero-compare, -Wtautological-unsigned-zero-compare.

Code
-Wtype-limits
Severity
warning

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true. -Wundefined-bool-conversion

Clang enables it by default. Clang has 2 messages for this flag.

Code
-Wundefined-bool-conversion
Severity
warning
Message
reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true
Message
‘this’ pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

… is only available. -Wunguarded-availability

Clang enables some of the diagnostics that it controls by default. It also controls -Wunguarded-availability-new. Clang has 3 messages for this flag.

Code
-Wunguarded-availability
Severity
warning
Message
{} is only available
Message
in {} environment
Message
{} is unavailable

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Empty delimited universal character name; treating as ‘\’ ‘…’ ‘{’ ‘}’. -Wunicode

Clang enables it by default. Clang has 7 messages for this flag.

Code
-Wunicode
Severity
warning
Message
empty delimited universal character name; treating as ‘\’ ‘{}’ ‘{’ ‘}’
Message
incomplete delimited universal character name; treating as ‘\’ ‘{}’ ‘{’ identifier
Message
incomplete universal character name; treating as ‘\’ followed by identifier
Message
\{} used with no following hex digits; treating as ‘\’ followed by identifier
Message
universal character name refers to a surrogate character
Message
universal character names are only valid in C99 or C++; treating as ‘\’ followed by identifier
Message
universal character names are only valid in C99 or C++

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Base class … is uninitialized when used here to access …. -Wuninitialized

Clang enables some of the diagnostics that it controls by default. It also controls -Wsometimes-uninitialized, -Wstatic-self-init, -Wuninitialized-const-pointer, -Wuninitialized-const-reference. Clang has 16 messages for this flag.

Code
-Wuninitialized
Severity
warning
Message
base class {} is uninitialized when used here to access {}
Message
field {} is uninitialized when used here
Message
struct
Message
interface
Message
union
Message
class
Message
enum
Message
reference {} is not yet bound to a value when used here

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Field. -Wuninitialized-explicit-init

Clang enables it by default. Clang has 3 messages for this flag.

Code
-Wuninitialized-explicit-init
Severity
warning
Message
field
Message
{}
Message
in {}

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Initialization of … may run twice when built into a shared library: it has external linkage and. -Wunique-object-duplication

Clang has 6 messages for this flag.

Code
-Wunique-object-duplication
Severity
warning
Message
initialization of {} may run twice when built into a shared library: it has external linkage and
Message
hidden visibility
Message
no import/export annotation
Message
{} may be duplicated when built into a shared library: it is mutable, with external linkage and
Message
hidden visibility
Message
no import/export annotation

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Expected ‘ON’ or ‘OFF’ or ‘DEFAULT’ in pragma. -Wunknown-pragmas

Clang enables some of the diagnostics that it controls by default. Clang has 20 messages for this flag.

Code
-Wunknown-pragmas
Severity
warning
Message
expected ‘ON’ or ‘OFF’ or ‘DEFAULT’ in pragma
Message
expected end of directive in pragma
Message
unknown pragma in STDC namespace
Message
pragma diagnostic pop could not pop, no matching push
Message
pragma diagnostic expected ‘error’, ‘warning’, ‘ignored’, ‘fatal’, ‘push’, or ‘pop’
Message
pragma diagnostic expected option name (e.g. “-Wundef”)
Message
unexpected token in pragma diagnostic
Message
#pragma execution_character_set expected ‘{}’

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Function. -Wunneeded-internal-declaration

Clang has 3 messages for this flag.

Code
-Wunneeded-internal-declaration
Severity
warning
Message
function
Message
variable
Message
‘static’ function {} declared in header file should be declared ‘static inline’

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Code will never be executed. -Wunreachable-code

Clang enables some of the diagnostics that it controls by default. It also controls -Wunreachable-code-fallthrough, -Wunreachable-code-generic-assoc, -Wunreachable-code-loop-increment.

Code
-Wunreachable-code
Severity
warning
Message
code will never be executed

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

A group of warnings. -Wunreachable-code-aggressive

Clang enables some of the diagnostics that it controls by default. It also controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return.

Code
-Wunreachable-code-aggressive
Severity
warning

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Due to lvalue conversion of the controlling expression, association of type … will never be selected because it is. -Wunreachable-code-generic-assoc

Clang enables it by default. Clang has 3 messages for this flag.

Code
-Wunreachable-code-generic-assoc
Severity
warning
Message
due to lvalue conversion of the controlling expression, association of type {} will never be selected because it is
Message
of array type
Message
qualified

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Unsafe pointer operation. -Wunsafe-buffer-usage

It also controls -Wunsafe-buffer-usage-in-container, -Wunsafe-buffer-usage-in-format-attr-call, -Wunsafe-buffer-usage-in-libc-call, -Wunsafe-buffer-usage-in-static-sized-array, -Wunsafe-buffer-usage-in-string-view, -Wunsafe-buffer-usage-in-unique-ptr-array-access, -Wunsafe-buffer-usage-main-argv. Clang has 9 messages for this flag.

Code
-Wunsafe-buffer-usage
Severity
warning
Message
unsafe pointer operation
Message
unsafe pointer arithmetic
Message
unsafe buffer access
Message
function introduces unsafe buffer manipulation
Message
unsafe invocation of {}
Message
field {} prone to unsafe buffer manipulation
Message
{} is an
Message
unsafe pointer used for buffer access

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Function … is unsafe. -Wunsafe-buffer-usage-in-libc-call

It also controls -Wunsafe-buffer-usage-in-libc-call-io, -Wunsafe-buffer-usage-in-libc-call-memory, -Wunsafe-buffer-usage-in-libc-call-numeric-conversion, -Wunsafe-buffer-usage-in-libc-call-printf, -Wunsafe-buffer-usage-in-libc-call-scanf, -Wunsafe-buffer-usage-in-libc-call-string-examination, -Wunsafe-buffer-usage-in-libc-call-string-manipulation.

Code
-Wunsafe-buffer-usage-in-libc-call
Severity
warning
Message
function {} is unsafe

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Unsafe pointer operation. -Wunsafe-buffer-usage-main-argv

Clang has 9 messages for this flag.

Code
-Wunsafe-buffer-usage-main-argv
Severity
warning
Message
unsafe pointer operation
Message
unsafe pointer arithmetic
Message
unsafe buffer access
Message
function introduces unsafe buffer manipulation
Message
unsafe invocation of {}
Message
field {} prone to unsafe buffer manipulation
Message
{} is an
Message
unsafe pointer used for buffer access

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

@available. -Wunsupported-availability-guard

Clang enables it by default. Clang has 4 messages for this flag.

Code
-Wunsupported-availability-guard
Severity
warning
Message
@available
Message
__builtin_available
Message
@available
Message
__builtin_available

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Debug information option ‘…’ is not supported; requires DWARF-… but target ‘…’ only provides DWARF-…. -Wunsupported-target-opt

Clang enables it by default. Clang has 2 messages for this flag.

Code
-Wunsupported-target-opt
Severity
warning
Message
debug information option ‘{}’ is not supported; requires DWARF-{} but target ‘{}’ only provides DWARF-{}
Message
debug information option ‘{}’ is not supported for target ‘{}’

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Initializer-string for character array is too long, array size is … but initializer has size … (including the null terminating character); did you mean to use the ‘nonstring’ attribute?. -Wunterminated-string-initialization

Code
-Wunterminated-string-initialization
Severity
warning
Message
initializer-string for character array is too long, array size is {} but initializer has size {} (including the null terminating character); did you mean to use the ‘nonstring’ attribute?

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Class. -Wunusable-partial-specialization

Clang has 4 messages for this flag.

Code
-Wunusable-partial-specialization
Severity
warning
Message
class
Message
variable
Message
a template parameter
Message
template parameters

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

A group of warnings. -Wunused

Clang enables some of the diagnostics that it controls by default. It also controls -Wunused-argument, -Wunused-but-set-variable, -Wunused-function, -Wunused-label, -Wunused-lambda-capture, -Wunused-local-typedef, -Wunused-private-field, -Wunused-property-ivar, -Wunused-value, -Wunused-variable.

Code
-Wunused
Severity
warning

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Argument ‘…’ requires profile-guided optimization information. -Wunused-command-line-argument

Clang enables it by default. Clang has 19 messages for this flag.

Code
-Wunused-command-line-argument
Severity
warning
Message
argument ‘{}’ requires profile-guided optimization information
Message
argument ‘{}’ requires profile-guided optimization information
Message
joined argument expects additional value: ‘{}’
Message
ignoring ‘-f
Message
no-
Message
{}: ‘{}’ input unused
Message
when ‘{}’ is present
Message
{}: ‘{}’ input unused in cpp mode

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Equality. -Wunused-comparison

Clang enables it by default. Clang has 4 messages for this flag.

Code
-Wunused-comparison
Severity
warning
Message
equality
Message
inequality
Message
relational
Message
three-way

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Unused. -Wunused-template

It also controls -Wunneeded-internal-declaration. Clang has 3 messages for this flag.

Code
-Wunused-template
Severity
warning
Message
unused
Message
function
Message
variable

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Ignoring return value of function declared with … attribute. -Wunused-value

Clang enables it by default. It also controls -Wunevaluated-expression, -Wunused-comparison, -Wunused-result. Clang has 11 messages for this flag.

Code
-Wunused-value
Severity
warning
Message
ignoring return value of function declared with {} attribute
Message
left operand of comma operator has no effect
Message
ignoring temporary created by a constructor declared with {} attribute
Message
: {}
Message
container access result unused - container access should not be used for side effects
Message
expression result unused
Message
ignoring
Message
return value

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

User-defined literal suffixes. -Wuser-defined-literals

Clang enables it by default. Clang has 5 messages for this flag.

Code
-Wuser-defined-literals
Severity
warning
Message
user-defined literal suffixes
Message
<ERROR>
Message
not starting with ‘_’
Message
containing ‘__’
Message
; no literal will invoke this operator

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Second argument to ‘va_start’ is not the last non-variadic parameter. -Wvarargs

Clang enables it by default. Clang has 7 messages for this flag.

Code
-Wvarargs
Severity
warning
Message
second argument to ‘va_start’ is not the last non-variadic parameter
Message
second argument to ‘va_arg’ is of array type {}; this va_arg has undefined behavior because arguments will never be compatible with array type
Message
second argument to ‘va_arg’ is of promotable type {}; this va_arg has undefined behavior because arguments will be promoted to {}
Message
passing
Message
an object that undergoes default argument promotion
Message
an object of reference type
Message
a parameter declared with the ‘register’ keyword

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Passing no argument for the ‘…’ parameter of a variadic macro is a C23 extension. -Wvariadic-macro-arguments-omitted

Clang has 3 messages for this flag.

Code
-Wvariadic-macro-arguments-omitted
Severity
warning
Message
passing no argument for the ‘…’ parameter of a variadic macro is a C23 extension
Message
passing no argument for the ‘…’ parameter of a variadic macro is a C++20 extension
Message
passing no argument for the ‘…’ parameter of a variadic macro is incompatible with C standards before C23

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Named variadic macros are a GNU extension. -Wvariadic-macros

Clang enables some of the diagnostics that it controls by default. Clang has 3 messages for this flag.

Code
-Wvariadic-macros
Severity
warning
Message
named variadic macros are a GNU extension
Message
__VA_OPT__ can only appear in the expansion of a variadic macro
Message
variadic macros are a C99 feature

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Implicit conversion truncates vector: … to …. -Wvector-conversion

Clang enables some of the diagnostics that it controls by default. Clang has 16 messages for this flag.

Code
-Wvector-conversion
Severity
warning
Message
implicit conversion truncates vector: {} to {}
Message
incompatible vector types
Message
assigning to {} from {}
Message
assigning to different types
Message
passing {} to parameter of type {}
Message
passing to parameter of different type
Message
returning {} from a function with result type {}
Message
returning from function with different return type

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.

Variable length arrays in C++ are a Clang extension; did you mean to use ‘static_assert’?. -Wvla-extension-static-assert

Clang enables some of the diagnostics that it controls by default. Clang has 2 messages for this flag.

Code
-Wvla-extension-static-assert
Severity
warning
Message
variable length arrays in C++ are a Clang extension; did you mean to use ‘static_assert’?
Message
variable length arrays in C++ are a Clang extension; did you mean to use ‘static_assert’?

Source: clang.llvm.org. JSON record. This entry is a card. Help write this page.