mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
fix bug 86546
This commit is contained in:
parent
db27590854
commit
92eae6c108
2 changed files with 43 additions and 1 deletions
|
@ -2247,5 +2247,47 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertEquals( decls.length, 1 );
|
||||
assertSame( decls[0], col.getName(6) );
|
||||
}
|
||||
|
||||
public void _testBug86274() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("class D {}; \n"); //$NON-NLS-1$
|
||||
buffer.append("D d1; \n"); //$NON-NLS-1$
|
||||
buffer.append("const D d2; \n"); //$NON-NLS-1$
|
||||
buffer.append("void foo() { \n"); //$NON-NLS-1$
|
||||
buffer.append(" typeid(d1) == typeid(d2); \n"); //$NON-NLS-1$
|
||||
buffer.append(" typeid( D ) == typeid(d2); \n"); //$NON-NLS-1$
|
||||
buffer.append("} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
tu.getVisitor().visitTranslationUnit(col);
|
||||
assertEquals( col.size(), 10 );
|
||||
|
||||
IVariable d1 = (IVariable) col.getName(6).resolveBinding();
|
||||
IVariable d2 = (IVariable) col.getName(7).resolveBinding();
|
||||
ICPPClassType D = (ICPPClassType) col.getName(8).resolveBinding();
|
||||
|
||||
assertInstances( col, D, 4 );
|
||||
assertInstances( col, d1, 2 );
|
||||
assertInstances( col, d2, 3 );
|
||||
}
|
||||
|
||||
public void testBug86546() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("void point ( int = 3, int = 4 ); \n"); //$NON-NLS-1$
|
||||
buffer.append("void foo() { \n"); //$NON-NLS-1$
|
||||
buffer.append(" point( 1, 2 ); \n"); //$NON-NLS-1$
|
||||
buffer.append(" point( 1 ); \n"); //$NON-NLS-1$
|
||||
buffer.append(" point( ); \n"); //$NON-NLS-1$
|
||||
buffer.append("} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
tu.getVisitor().visitTranslationUnit(col);
|
||||
|
||||
IFunction point = (IFunction) col.getName(0).resolveBinding();
|
||||
|
||||
assertInstances( col, point, 4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1301,7 +1301,7 @@ public class CPPSemantics {
|
|||
//parameter has a default argument
|
||||
else {
|
||||
IASTParameterDeclaration [] params = function.getParameters();
|
||||
for( int j = num - 1; j > ( numParameters - num); j-- ){
|
||||
for( int j = num - 1; j >= numParameters; j-- ){
|
||||
if( params[j].getDeclarator().getInitializer() == null ){
|
||||
functions[i] = null;
|
||||
size--;
|
||||
|
|
Loading…
Add table
Reference in a new issue