Clang error: instance variable A has conflicting type: B vs C (err_conflicting_ivar_type)
Jump to navigation
Jump to search
Text |
| |||||
---|---|---|---|---|---|---|
Type | Error | |||||
Category | Semantic Issue | |||||
Internal Id | err_conflicting_ivar_type | |||||
Internal Message | instance variable %0 has conflicting type%diff{: $ vs $|}1,2
| |||||
Regular Expression | (?:error|fatal error)\: instance variable (.*?) has conflicting type(?:\: (.*?) vs (.*?)|)
| |||||
First Commit | 2009-03-04 b1c4d5507fad The basic representation of diagnostics information in tablegen format, plus (uncommented and incomp... |
Description
Example
Flags | -xobjective-c
|
|
---|---|---|
Source |
@interface C { int x; } @end @implementation C { float x; } @end
| |
Compiler Output |
<source>:1:56: error: instance variable 'x' has conflicting type: 'float' vs 'int' <source>:1:20: note: previous definition is here <source>:1:12: warning: class 'C' defined without specifying a base class [-Wobjc-root-class] <source>:1:13: note: add a super class to fix this problem |
Clang Internals (17.0.6)
Git Commit Message
The basic representation of diagnostics information in tablegen format, plus (uncommented and incomplete) test conversions of the existing def files to this format. llvm-svn: 66064
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaDeclObjC.cpp (line 2206)
void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **ivars, unsigned numIvars, SourceLocation RBrace) {
// ...
for (; numIvars > 0 && IVI != IVE; ++IVI) {
// ...
// First, make sure the types match.
if (!Context.hasSameType(ImplIvar->getType(), ClsIvar->getType())) {
Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_type) << ImplIvar->getIdentifier() << ImplIvar->getType() << ClsIvar->getType();
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/SemaObjC/class-bitfield.m
- clang/test/SemaObjC/class-bitfield.m:32:9: error: instance variable 'isa' has conflicting type: 'char *' vs 'void *'