// }
public void testSelfReferencingVariable_452325() throws Exception {
// Just check that codan runs without any exceptions being thrown.
- checkSampleAbove();
+ checkSampleAboveCpp();
+ }
+
+ // int bar(int x) { return x; }
+ // int foo() { // error
+ // int waldo = bar(waldo);
+ // if (bar(waldo));
+ // }
+ public void testSelfReferencingVariable_479638() throws Exception {
+ // Just check that codan runs without any exceptions being thrown.
+ checkSampleAboveCpp();
}
// int foo(int x) { // error
private IType fType;
private boolean fCheckedIsValueDependent;
private boolean fIsValueDependent;
- private boolean fIsTypeDependent;
private boolean fCheckedIsTypeDependent;
+ private boolean fIsTypeDependent;
+ private boolean fCheckedIsConstantExpression;
+ private boolean fIsConstantExpression;
public EvalBinding(IBinding binding, IType type, IASTNode pointOfDefinition) {
this(binding, type, findEnclosingTemplate(pointOfDefinition));
@Override
public boolean isConstantExpression(IASTNode point) {
+ if (!fCheckedIsConstantExpression) {
+ fCheckedIsConstantExpression = true;
+ fIsConstantExpression = computeIsConstantExpression(point);
+ }
+ return fIsConstantExpression;
+ }
+
+ private boolean computeIsConstantExpression(IASTNode point) {
return fBinding instanceof IEnumerator
|| fBinding instanceof ICPPFunction
|| (fBinding instanceof IVariable && isConstexprValue(((IVariable) fBinding).getInitialValue(), point));