Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java2
4 files changed, 22 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index bb6cb8876b0..d27cea8328e 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -103,6 +103,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
@@ -13407,4 +13408,22 @@ public class AST2CPPTests extends AST2CPPTestBase {
public void testClassFromInitList_549036() throws Exception {
parseAndCheckImplicitNameBindings();
}
+
+ // int a = 42, b = 42;
+ // float c = 3.14, d = 3.14;
+ // char e[] = "waldo", f[] = "waldo";
+ public void testLiteralExpressionEquivalence_551689() throws Exception {
+ BindingAssertionHelper helper = getAssertionHelper();
+ ICPPASTExpression a = helper.assertNode("a = 42", "42");
+ ICPPASTExpression b = helper.assertNode("b = 42", "42");
+ assertTrue(a.getEvaluation().isEquivalentTo(b.getEvaluation()));
+
+ ICPPASTExpression c = helper.assertNode("c = 3.14", "3.14");
+ ICPPASTExpression d = helper.assertNode("d = 3.14", "3.14");
+ assertTrue(c.getEvaluation().isEquivalentTo(d.getEvaluation()));
+
+ ICPPASTExpression e = helper.assertNode("e[] = \"waldo\"", "\"waldo\"");
+ ICPPASTExpression f = helper.assertNode("f[] = \"waldo\"", "\"waldo\"");
+ assertTrue(e.getEvaluation().isEquivalentTo(f.getEvaluation()));
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
index 6aa59fb0cf2..a8b5ccf245c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CStringValue.java
@@ -251,6 +251,6 @@ public final class CStringValue implements IValue {
return false;
}
CStringValue o = (CStringValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
index a0837864035..cb233077d38 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/FloatingPointValue.java
@@ -182,6 +182,6 @@ public final class FloatingPointValue implements IValue {
return false;
}
FloatingPointValue o = (FloatingPointValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
index 1cf9d4f822b..4487599727f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/IntegralValue.java
@@ -297,6 +297,6 @@ public class IntegralValue implements IValue {
return false;
}
IntegralValue o = (IntegralValue) other;
- return fFixedValue.equals(o.fFixedValue);
+ return CharArrayUtils.equals(fFixedValue, o.fFixedValue);
}
}

Back to the top