Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
index dbb79403e81..21bf02ae84e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
@@ -402,6 +402,18 @@ public class Value implements IValue {
public static boolean isDependentValue(IValue nonTypeValue) {
if (nonTypeValue == null)
return false;
+ // Unknown values may or may not be dependent. In the case of a template with
+ // a non-type template argument, whether or not the argument's value is dependent
+ // determines whether or not the template gets instantiated. In light of this,
+ // it's safer to assume that an unknown value is dependent because:
+ // 1. Instantiating a template with a non-type template argument whose value is
+ // unknown is useless.
+ // 2. Instantiating such a template can lead to an infinite recursion of
+ // instantiations (e.g. consider a template A<N> that delegates to A<N - 1>,
+ // with A<0> being specialized to end the recursion - if N is unknown,
+ // N - 1 will be unknown as well, and we get an infinite recursion).
+ if (nonTypeValue == UNKNOWN)
+ return true;
ICPPEvaluation eval = nonTypeValue.getEvaluation();
return eval != null && eval.isValueDependent();
}

Back to the top