Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndrew Niefer2004-09-30 17:19:10 -0400
committerAndrew Niefer2004-09-30 17:19:10 -0400
commit0ab0b97b0f14ed3899fa12ea87c82d012fd5f466 (patch)
tree4c1bbae707b4f6ae7c8cd018c8e122cc1052d312 /core
parent30a7d6170fc6ee0b5e3815fd8ace7a42221a109a (diff)
downloadorg.eclipse.cdt-0ab0b97b0f14ed3899fa12ea87c82d012fd5f466.tar.gz
org.eclipse.cdt-0ab0b97b0f14ed3899fa12ea87c82d012fd5f466.tar.xz
org.eclipse.cdt-0ab0b97b0f14ed3899fa12ea87c82d012fd5f466.zip
bug 72814: [Parser] Open Declaration fails on std::vector<int> reference
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java10
3 files changed, 31 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
index 419220ca730..b4aad1f0213 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/SelectionParseTest.java
@@ -478,5 +478,25 @@ public class SelectionParseTest extends SelectionParseBaseTest {
assertTrue( node instanceof IASTClassSpecifier );
assertEquals( ((IASTClassSpecifier)node).getName(), "A" ); //$NON-NLS-1$
}
+
+ public void testBug72814() throws Exception{
+ Writer writer = new StringWriter();
+ writer.write( "namespace N{ \n"); //$NON-NLS-1$
+ writer.write( " template < class T > class AAA { T _t };\n"); //$NON-NLS-1$
+ writer.write( "} \n"); //$NON-NLS-1$
+ writer.write( "N::AAA<int> a; \n"); //$NON-NLS-1$
+
+ String code = writer.toString();
+ int startIndex = code.indexOf( "AAA<int>" ); //$NON-NLS-1$
+ IASTNode node = parse( code, startIndex, startIndex + 3 );
+
+ assertTrue( node instanceof IASTClassSpecifier );
+ assertEquals( ((IASTClassSpecifier)node).getName(), "AAA" ); //$NON-NLS-1$
+
+ node = parse( code, startIndex, startIndex + 8 );
+
+ assertTrue( node instanceof IASTClassSpecifier );
+ assertEquals( ((IASTClassSpecifier)node).getName(), "AAA" ); //$NON-NLS-1$
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
index fd6e66d8b08..0039a0d1844 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
@@ -6607,7 +6607,7 @@ public class Parser implements IParserData, IParser
// duple is a sub-duple of greaterContextDuple
if( duple.getFirstToken().equals( greaterContextDuple.getFirstToken() ))
finalDuple = duple; // => do not use greaterContextDuple
- else if( duple.getLastToken().equals( greaterContextDuple.getLastToken() ))
+ else if( duple.getLastSegment().getFirstToken().equals( greaterContextDuple.getLastSegment().getFirstToken() ))
finalDuple = greaterContextDuple; // => use greaterContextDuple
else
throw new ParseError( ParseError.ParseErrorKind.OFFSET_RANGE_NOT_NAME );
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java
index 025b34c1861..e6caac27111 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/token/BasicTokenDuple.java
@@ -355,6 +355,16 @@ public class BasicTokenDuple implements ITokenDuple {
IToken iter = firstToken;
while( iter != lastToken)
{
+ if( iter.getType() == IToken.tLT ){
+ iter = TokenFactory.consumeTemplateIdArguments( iter, lastToken );
+ if( iter.getType() == IToken.tGT ){
+ if( iter == lastToken ) break;
+ iter = iter.getNext();
+ continue;
+ }
+ continue;
+ }
+
if( iter.isOperator() )
{
iter = iter.getNext();

Back to the top