mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 95741
This commit is contained in:
parent
ccddd79e27
commit
3376e0abe0
2 changed files with 31 additions and 5 deletions
|
@ -4271,4 +4271,22 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertSame( mem, col.getName(6).resolveBinding() );
|
||||
assertSame( mem, col.getName(8).resolveBinding() );
|
||||
}
|
||||
|
||||
public void testBug95741() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("void trace( const void * ); \n"); //$NON-NLS-1$
|
||||
buffer.append("class Foo { \n"); //$NON-NLS-1$
|
||||
buffer.append(" public: int import(); \n"); //$NON-NLS-1$
|
||||
buffer.append("}; \n"); //$NON-NLS-1$
|
||||
buffer.append("int Foo::import(){ \n"); //$NON-NLS-1$
|
||||
buffer.append(" trace( this ); \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 trace = (ICPPFunction) col.getName(0).resolveBinding();
|
||||
assertSame( trace, col.getName(7).resolveBinding() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2711,13 +2711,21 @@ public class CPPSemantics {
|
|||
IType t = getUltimateType( trg, true );
|
||||
|
||||
IType sPrev = src;
|
||||
while( sPrev instanceof ITypeContainer && ((ITypeContainer)sPrev).getType() != s )
|
||||
sPrev = ((ITypeContainer)sPrev).getType();
|
||||
|
||||
while( sPrev instanceof ITypeContainer ){
|
||||
IType next = ((ITypeContainer)sPrev).getType();
|
||||
if( next == s || (next instanceof IQualifierType && ((IQualifierType)next).getType() == s ) )
|
||||
break;
|
||||
sPrev = next;
|
||||
}
|
||||
|
||||
if( sPrev instanceof IPointerType && s instanceof ICPPClassType ){
|
||||
IType tPrev = trg;
|
||||
while( tPrev instanceof ITypeContainer && ((ITypeContainer)tPrev).getType() != t )
|
||||
tPrev = ((ITypeContainer)tPrev).getType();
|
||||
while( tPrev instanceof ITypeContainer ){
|
||||
IType next = ((ITypeContainer)tPrev).getType();
|
||||
if( next == t || (next instanceof IQualifierType && ((IQualifierType)next).getType() == t ) )
|
||||
break;
|
||||
tPrev = next;
|
||||
}
|
||||
|
||||
//4.10-2 an rvalue of type "pointer to cv T", where T is an object type can be
|
||||
//converted to an rvalue of type "pointer to cv void"
|
||||
|
|
Loading…
Add table
Reference in a new issue