mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 95419
This commit is contained in:
parent
78f1bf9054
commit
7c1d5beb4f
2 changed files with 33 additions and 0 deletions
|
@ -4220,4 +4220,18 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
ICPPField bar = (ICPPField) col.getName(1).resolveBinding();
|
ICPPField bar = (ICPPField) col.getName(1).resolveBinding();
|
||||||
assertSame( bar, col.getName(6).resolveBinding() );
|
assertSame( bar, col.getName(6).resolveBinding() );
|
||||||
}
|
}
|
||||||
|
public void testBug95419() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("int strcmp( const char * ); \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void f( const char * const * argv ){ \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" strcmp( *argv ); \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("} \n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
|
||||||
|
ICPPFunction strcmp = (ICPPFunction) col.getName(0).resolveBinding();
|
||||||
|
assertSame( strcmp, col.getName(4).resolveBinding() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2531,6 +2531,25 @@ public class CPPSemantics {
|
||||||
source = new CPPPointerType( ((IArrayType)source).getType() );
|
source = new CPPPointerType( ((IArrayType)source).getType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//4.1 if T is a non-class type, the type of the rvalue is the cv-unqualified version of T
|
||||||
|
if( source instanceof IQualifierType ){
|
||||||
|
IType t = ((IQualifierType)source).getType();
|
||||||
|
while( t instanceof ITypedef )
|
||||||
|
t = ((ITypedef)t).getType();
|
||||||
|
if( !(t instanceof ICPPClassType) ){
|
||||||
|
source = t;
|
||||||
|
}
|
||||||
|
} else if( source instanceof IPointerType &&
|
||||||
|
( ((IPointerType)source).isConst() || ((IPointerType)source).isVolatile() ) )
|
||||||
|
{
|
||||||
|
IType t = ((IPointerType)source).getType();
|
||||||
|
while( t instanceof ITypedef )
|
||||||
|
t = ((ITypedef)t).getType();
|
||||||
|
if( !(t instanceof ICPPClassType) ){
|
||||||
|
source = new CPPPointerType( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cost.source = source;
|
cost.source = source;
|
||||||
cost.target = target;
|
cost.target = target;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue