mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 103578
This commit is contained in:
parent
8081caaf0e
commit
bbbb57bd53
3 changed files with 33 additions and 3 deletions
|
@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
|
@ -1824,4 +1825,25 @@ public class AST2TemplateTests extends AST2BaseTest {
|
|||
f1 = (ICPPFunctionTemplate) col.getName(1).resolveBinding();
|
||||
assertSame( f1, col.getName(10).resolveBinding() );
|
||||
}
|
||||
|
||||
public void testBug103578() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("template <class T, int someConst = 0 > class A {}; \n"); //$NON-NLS-1$
|
||||
buffer.append("int f() { \n"); //$NON-NLS-1$
|
||||
buffer.append(" const int local = 10; \n"); //$NON-NLS-1$
|
||||
buffer.append(" A<int, local> broken; \n"); //$NON-NLS-1$
|
||||
buffer.append("}; \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP, true, true );
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
tu.accept( col );
|
||||
|
||||
ICPPClassTemplate A = (ICPPClassTemplate) col.getName(2).resolveBinding();
|
||||
IVariable local = (IVariable) col.getName(4).resolveBinding();
|
||||
|
||||
ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding();
|
||||
assertTrue( a instanceof ICPPTemplateInstance );
|
||||
assertSame( ((ICPPTemplateInstance)a).getTemplateDefinition(), A );
|
||||
assertSame( local, col.getName(7).resolveBinding() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1606,6 +1606,13 @@ public class CPPVisitor {
|
|||
} catch (DOMException e) {
|
||||
type = e.getProblem();
|
||||
}
|
||||
} else if( binding instanceof IVariable ){
|
||||
//this is to help with the ambiguity between typeid & idexpression in template arguments
|
||||
try {
|
||||
type = ((IVariable)binding).getType();
|
||||
} catch (DOMException e) {
|
||||
type = e.getProblem();
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
|
|
|
@ -1339,13 +1339,13 @@
|
|||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.ui.IndexerPage">
|
||||
<!--
|
||||
|
||||
<indexerUI
|
||||
class="org.eclipse.cdt.ui.dialogs.DOMSourceIndexerBlock"
|
||||
id="org.eclipse.cdt.ui.DOMASTSourceIndexerUI"
|
||||
indexerID="org.eclipse.cdt.core.domsourceindexer"
|
||||
name="%CDTIndexer.domsourceindexer"/>
|
||||
-->
|
||||
|
||||
<indexerUI
|
||||
class="org.eclipse.cdt.ui.dialogs.CTagsIndexerBlock"
|
||||
indexerID="org.eclipse.cdt.core.ctagsindexer"
|
||||
|
@ -1356,12 +1356,13 @@
|
|||
indexerID="org.eclipse.cdt.core.nullindexer"
|
||||
name="%CDTIndexer.nullindexer"
|
||||
id="org.eclipse.cdt.ui.nullindexerUI"/>
|
||||
<!--
|
||||
<indexerUI
|
||||
class="org.eclipse.cdt.ui.dialogs.NullIndexerBlock"
|
||||
id="org.eclipse.cdt.ui.DOMASTSourceIndexerUI"
|
||||
indexerID="org.eclipse.cdt.core.domsourceindexer"
|
||||
name="%CDTIndexer.domsourceindexer"/>
|
||||
|
||||
-->
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.ui.completionContributors">
|
||||
|
|
Loading…
Add table
Reference in a new issue