mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
fix bug 69745
This commit is contained in:
parent
efc3b9c4ab
commit
af4317e0a4
3 changed files with 26 additions and 2 deletions
|
@ -115,4 +115,25 @@ public class CompleteParseProblemTest extends CompleteParseBaseTest {
|
|||
IASTFunction f = (IASTFunction) i.next();
|
||||
IASTVariable varI = (IASTVariable) i.next();
|
||||
}
|
||||
|
||||
public void testBug69745() throws Exception
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "namespace NS{ template < class T > int foo(){}; } \n" ); //$NON-NLS-1$
|
||||
buffer.append( "void f() { using NS::foo; using NS::foo<int>; } \n" ); //$NON-NLS-1$
|
||||
|
||||
String code = buffer.toString();
|
||||
|
||||
parse( code, false );
|
||||
|
||||
int start = code.indexOf( "using NS::foo<int>;" ); //$NON-NLS-1$
|
||||
int end = start + "using NS::foo<int>;".length(); //$NON-NLS-1$
|
||||
|
||||
assertEquals( callback.problems.size(), 1 );
|
||||
IProblem p = (IProblem) callback.problems.get( 0 );
|
||||
|
||||
assertEquals( p.getSourceStart(), start );
|
||||
assertEquals( p.getSourceEnd(), end );
|
||||
assertEquals( p.getID(), IProblem.SEMANTIC_INVALID_USING );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -367,7 +367,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "usingClause:createUsingDeclaration", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset(), last.getEndOffset(), firstToken.getLineNumber());
|
||||
if( e1 instanceof ASTSemanticException && ((ASTSemanticException)e1).getProblem() != null )
|
||||
throwBacktrack(((ASTSemanticException)e1).getProblem());
|
||||
else
|
||||
throwBacktrack(firstToken.getOffset(), last.getEndOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
declaration.acceptElement( requestor, astFactory.getReferenceManager() );
|
||||
setCompletionValues(scope, getCompletionKindForDeclaration(scope, null), KeywordSetKey.DECLARATION );
|
||||
|
|
|
@ -1547,7 +1547,7 @@ public class ParserSymbolTable {
|
|||
boolean okToAdd = false;
|
||||
|
||||
//7.3.3-5 A using-declaration shall not name a template-id
|
||||
if( obj.isTemplateMember() && obj.getContainingSymbol().isType( ITypeInfo.t_template ) ){
|
||||
if( obj.isTemplateInstance() && obj.getInstantiatedSymbol().getContainingSymbol().isType( ITypeInfo.t_template ) ){
|
||||
okToAdd = false;
|
||||
}
|
||||
//7.3.3-4
|
||||
|
|
Loading…
Add table
Reference in a new issue