Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-11-18 01:38:10 +0000
committerNathan Ridge2018-11-24 20:52:34 +0000
commit86b8f216235b208604ba1cc6ac20d49fc5c9eced (patch)
tree1d13ef08cc3f1c1c4c09478549f94eebcd7fac7f
parent1bb3bb5768725ec5db2d2f48f5e81344cf5175e3 (diff)
downloadorg.eclipse.cdt-86b8f216235b208604ba1cc6ac20d49fc5c9eced.tar.gz
org.eclipse.cdt-86b8f216235b208604ba1cc6ac20d49fc5c9eced.tar.xz
org.eclipse.cdt-86b8f216235b208604ba1cc6ac20d49fc5c9eced.zip
Bug 540549 - Have all template parameter bindings implement ICPPUnknownBinding
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateParameter.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameter.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameterSpecialization.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameter.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterSpecialization.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameterSpecialization.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameter.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameterSpecialization.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java26
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java5
17 files changed, 82 insertions, 36 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
index 569c4fbdede..46ebe372bc0 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java
@@ -525,6 +525,9 @@ public class AST2TestBase extends SemanticTestBase {
final protected void assertNoProblemBindings(NameCollector col) {
for (IASTName n : col.nameList) {
+ if (n.getRawSignature().contains("waldo")) {
+ n.resolveBinding();
+ }
assertFalse("ProblemBinding for " + n.getRawSignature(), n.resolveBinding() instanceof IProblemBinding);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateParameter.java
index 266639dd11d..ccb192f9008 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPTemplateParameter.java
@@ -17,6 +17,10 @@ package org.eclipse.cdt.core.dom.ast.cpp;
/**
* Base interface for all template parameters (non-type, type and template).
*
+ * All template parameters should implement ICPPUnknownBinding as well
+ * (but ICPPTemplateParameter cannot extend ICPPUnknownBinding because
+ * ICPPUnknownBinding is not API).
+ *
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameter.java
index ae09caa88f6..9d960cdddb3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameter.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
+import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
@@ -26,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
@@ -171,4 +173,11 @@ public class CPPTemplateNonTypeParameter extends CPPTemplateParameter implements
public boolean isConstexpr() {
return false;
}
+
+ @Override
+ public ICPPScope asScope() throws DOMException {
+ // A non-type template parameter can never appear on the left hand side
+ // of a scope resolution operator.
+ return null;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameterSpecialization.java
index 1905c4441fb..de8049eb2ba 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameterSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeParameterSpecialization.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
+import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -94,4 +95,11 @@ public class CPPTemplateNonTypeParameterSpecialization extends CPPTemplateParame
public IASTExpression getDefault() {
return null;
}
+
+ @Override
+ public ICPPScope asScope() throws DOMException {
+ // A non-type template parameter can never appear on the left hand side
+ // of a scope resolution operator.
+ return null;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameter.java
index 0a54e4dcee8..59488bea276 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameter.java
@@ -38,7 +38,7 @@ import org.eclipse.core.runtime.PlatformObject;
* Base implementation for template parameter bindings in the AST.
*/
public abstract class CPPTemplateParameter extends PlatformObject
- implements ICPPTemplateParameter, ICPPInternalBinding, ICPPTwoPhaseBinding {
+ implements ICPPTemplateParameter, ICPPInternalBinding, ICPPTwoPhaseBinding, ICPPUnknownBinding {
private IASTName[] declarations;
private final int fParameterID;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterSpecialization.java
index 62df4d44d47..adc6de5c5c6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateParameterSpecialization.java
@@ -30,7 +30,7 @@ import org.eclipse.core.runtime.PlatformObject;
* CPPTemplateTypeParameterSpecialization, and CPPTemplateTemplateParameterSpecialization.
*/
public abstract class CPPTemplateParameterSpecialization extends PlatformObject
- implements ICPPTemplateParameter, ICPPSpecialization {
+ implements ICPPTemplateParameter, ICPPSpecialization, ICPPUnknownBinding {
private final ICPPSpecialization fOwner;
private final ICPPScope fScope;
private final ICPPTemplateParameter fSpecialized;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java
index 1b56a4b52a4..c26466b0f54 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameter.java
@@ -48,7 +48,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
* A template template parameter.
*/
public class CPPTemplateTemplateParameter extends CPPTemplateParameter
- implements ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownBinding, ICPPUnknownType {
+ implements ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownType {
private ICPPTemplateParameter[] templateParameters;
private ObjectMap instances;
private ICPPScope unknownScope;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameterSpecialization.java
index cf63e8e4000..2450a2a8957 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameterSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTemplateParameterSpecialization.java
@@ -42,6 +42,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
*/
public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParameterSpecialization
implements ICPPTemplateTemplateParameter {
+ // The scope of the type named by the parameter specialization.
+ // Not to be confused with CPPTemplateParameterSpecialization.fScope,
+ // which is the enclosing scope in which the parameter specialization lives.
+ private ICPPScope fScope;
public CPPTemplateTemplateParameterSpecialization(ICPPSpecialization owner, ICPPScope scope,
ICPPTemplateTemplateParameter specialized, ICPPTemplateArgument defaultValue) {
@@ -175,4 +179,12 @@ public class CPPTemplateTemplateParameterSpecialization extends CPPTemplateParam
}
return o;
}
+
+ @Override
+ public ICPPScope asScope() throws DOMException {
+ if (fScope == null) {
+ return new CPPUnknownTypeScope(this, new CPPASTName(getNameCharArray()));
+ }
+ return fScope;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameter.java
index efc719545aa..75e151a74d2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameter.java
@@ -30,7 +30,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
* The standard template parameter (template<typename T> or template<class T>).
*/
public class CPPTemplateTypeParameter extends CPPTemplateParameter
- implements ICPPTemplateTypeParameter, ICPPUnknownType, ICPPUnknownBinding {
+ implements ICPPTemplateTypeParameter, ICPPUnknownType {
private ICPPScope unknownScope;
private final boolean fIsParameterPack;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameterSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameterSpecialization.java
index 6672fb0a6f0..b55cb9e065a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameterSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateTypeParameterSpecialization.java
@@ -31,6 +31,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
*/
public class CPPTemplateTypeParameterSpecialization extends CPPTemplateParameterSpecialization
implements ICPPTemplateTypeParameter {
+ // The scope of the type named by the parameter specialization.
+ // Not to be confused with CPPTemplateParameterSpecialization.fScope,
+ // which is the enclosing scope in which the parameter specialization lives.
+ private ICPPScope fScope;
public CPPTemplateTypeParameterSpecialization(ICPPSpecialization owner, ICPPScope scope,
ICPPTemplateTypeParameter specialized, ICPPTemplateArgument defaultValue) {
@@ -69,4 +73,12 @@ public class CPPTemplateTypeParameterSpecialization extends CPPTemplateParameter
}
return o;
}
+
+ @Override
+ public ICPPScope asScope() throws DOMException {
+ if (fScope == null) {
+ return new CPPUnknownTypeScope(this, new CPPASTName(getNameCharArray()));
+ }
+ return fScope;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 9df7a849964..d894fc5d486 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -1217,10 +1217,6 @@ public class CPPTemplates {
return r;
}
- if (type instanceof ICPPTemplateParameter) {
- return determinePackSize((ICPPTemplateParameter) type, tpMap);
- }
-
if (type instanceof TypeOfDependentExpression) {
return ((TypeOfDependentExpression) type).getEvaluation().determinePackSize(tpMap);
}
@@ -1248,23 +1244,23 @@ public class CPPTemplates {
return r;
}
- static int determinePackSize(ICPPTemplateParameter tpar, ICPPTemplateParameterMap tpMap) {
- if (tpar.isParameterPack()) {
- ICPPTemplateArgument[] args = tpMap.getPackExpansion(tpar);
- if (args != null) {
- return args.length;
+ static int determinePackSize(ICPPUnknownBinding binding, ICPPTemplateParameterMap tpMap) {
+ if (binding instanceof ICPPTemplateParameter) {
+ ICPPTemplateParameter tpar = (ICPPTemplateParameter) binding;
+ if (tpar.isParameterPack()) {
+ ICPPTemplateArgument[] args = tpMap.getPackExpansion(tpar);
+ if (args != null) {
+ return args.length;
+ }
+ return PACK_SIZE_DEFER;
}
- return PACK_SIZE_DEFER;
+ return PACK_SIZE_NOT_FOUND;
}
- return PACK_SIZE_NOT_FOUND;
- }
-
- static int determinePackSize(ICPPUnknownBinding binding, ICPPTemplateParameterMap tpMap) {
int r = PACK_SIZE_NOT_FOUND;
if (binding instanceof ICPPDeferredClassInstance) {
ICPPDeferredClassInstance dcl = (ICPPDeferredClassInstance) binding;
if (dcl.getClassTemplate() instanceof ICPPTemplateTemplateParameter) {
- r = combinePackSize(r, determinePackSize((ICPPTemplateParameter) dcl.getClassTemplate(), tpMap));
+ r = combinePackSize(r, determinePackSize((ICPPUnknownBinding) dcl.getClassTemplate(), tpMap));
}
ICPPTemplateArgument[] args = dcl.getTemplateArguments();
for (ICPPTemplateArgument arg : args) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
index 39f4eb38d6c..6cf8de08188 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
@@ -481,9 +481,6 @@ public class EvalBinding extends CPPDependentEvaluation {
if (binding instanceof IEnumerator) {
return CPPTemplates.determinePackSize(((IEnumerator) binding).getValue(), tpMap);
}
- if (binding instanceof ICPPTemplateNonTypeParameter) {
- return CPPTemplates.determinePackSize((ICPPTemplateNonTypeParameter) binding, tpMap);
- }
if (binding instanceof ICPPUnknownBinding) {
return CPPTemplates.determinePackSize((ICPPUnknownBinding) binding, tpMap);
}
@@ -500,7 +497,7 @@ public class EvalBinding extends CPPDependentEvaluation {
if (binding instanceof ICPPTemplateDefinition) {
ICPPTemplateParameter[] parameters = ((ICPPTemplateDefinition) binding).getTemplateParameters();
for (ICPPTemplateParameter param : parameters) {
- r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(param, tpMap));
+ r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize((ICPPUnknownBinding) param, tpMap));
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
index 06aceebca0a..26c0d6c8844 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
@@ -53,7 +53,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
@@ -237,6 +236,9 @@ public class EvalID extends CPPDependentEvaluation {
if (binding instanceof CPPFunctionSet) {
return new EvalFunctionSet((CPPFunctionSet) binding, qualified, isAddressOf(expr), null, expr);
}
+ if (binding instanceof ICPPTemplateNonTypeParameter) { // has to come before ICPPUnknownBinding
+ return new EvalBinding(binding, null, expr);
+ }
if (binding instanceof ICPPUnknownBinding) {
// If the id-expression names a variable template, there is no need to defer name lookup.
if (binding instanceof ICPPDeferredVariableInstance) {
@@ -305,8 +307,7 @@ public class EvalID extends CPPDependentEvaluation {
}
return new EvalBinding(binding, null, expr);
}
- if (binding instanceof ICPPTemplateNonTypeParameter || binding instanceof IVariable
- || binding instanceof IFunction) {
+ if (binding instanceof IVariable || binding instanceof IFunction) {
return new EvalBinding(binding, null, expr);
}
return EvalFixed.INCOMPLETE;
@@ -497,10 +498,7 @@ public class EvalID extends CPPDependentEvaluation {
@Override
public int determinePackSize(ICPPTemplateParameterMap tpMap) {
int r = fFieldOwner != null ? fFieldOwner.determinePackSize(tpMap) : CPPTemplates.PACK_SIZE_NOT_FOUND;
- if (fNameOwner instanceof ICPPTemplateParameter) {
- r = CPPTemplates.combinePackSize(r,
- CPPTemplates.determinePackSize((ICPPTemplateParameter) fNameOwner, tpMap));
- } else if (fNameOwner instanceof ICPPUnknownBinding) {
+ if (fNameOwner instanceof ICPPUnknownBinding) { // handles template parameters as well
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize((ICPPUnknownBinding) fNameOwner, tpMap));
}
if (fTemplateArgs != null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
index da5eaa739bf..069b772336c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
@@ -15,6 +15,7 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.pdom.dom.IInternalPDOMNode;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
import org.eclipse.core.runtime.CoreException;
@@ -22,7 +23,7 @@ import org.eclipse.core.runtime.CoreException;
/**
* Interface for template parameters stored in the index.
*/
-public interface IPDOMCPPTemplateParameter extends IInternalPDOMNode, ICPPTemplateParameter {
+public interface IPDOMCPPTemplateParameter extends IInternalPDOMNode, ICPPTemplateParameter, ICPPUnknownBinding {
IPDOMCPPTemplateParameter[] EMPTY_ARRAY = {};
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
index d4bd64f3be8..8c137090c0f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
@@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
@@ -235,4 +236,11 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding
public IASTExpression getDefault() {
return null;
}
+
+ @Override
+ public ICPPScope asScope() throws DOMException {
+ // A non-type template parameter can never appear on the left hand side
+ // of a scope resolution operator.
+ return null;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
index e096a4948f8..b33a90157cc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
@@ -38,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
@@ -52,7 +51,7 @@ import org.eclipse.core.runtime.CoreException;
* Implementation of template template parameters for the index.
*/
public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding implements ICPPTemplateTemplateParameter,
- ICPPUnknownBinding, ICPPUnknownType, IIndexType, IPDOMCPPTemplateParameter, IPDOMCPPTemplateParameterOwner {
+ ICPPUnknownType, IIndexType, IPDOMCPPTemplateParameter, IPDOMCPPTemplateParameterOwner {
private static final int PACK_BIT = 1 << 31;
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
index c5307d286d7..0bd5e31db89 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
@@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeArgument;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexType;
@@ -41,8 +40,8 @@ import org.eclipse.core.runtime.CoreException;
/**
* Binding for template type parameters in the index.
*/
-class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMemberOwner, ICPPTemplateTypeParameter,
- ICPPUnknownBinding, ICPPUnknownType, IIndexType, IPDOMCPPTemplateParameter {
+class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding
+ implements IPDOMMemberOwner, ICPPTemplateTypeParameter, ICPPUnknownType, IIndexType, IPDOMCPPTemplateParameter {
private static final int PACK_BIT = 1 << 31;
private static final int DEFAULT_TYPE = PDOMCPPBinding.RECORD_SIZE;

Back to the top