Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Vogt2019-03-28 03:07:51 -0400
committerNathan Ridge2019-03-30 17:10:48 -0400
commit3a95ee0655073c10bb719c09fb069ce56094ef12 (patch)
tree3f0ed9b93284c55560d7c063e8c38d4829086e2f /core/org.eclipse.cdt.core.tests
parent92272c64659b19bbc11c27cf1a1857b4f1f68e0e (diff)
downloadorg.eclipse.cdt-3a95ee0655073c10bb719c09fb069ce56094ef12.tar.gz
org.eclipse.cdt-3a95ee0655073c10bb719c09fb069ce56094ef12.tar.xz
org.eclipse.cdt-3a95ee0655073c10bb719c09fb069ce56094ef12.zip
Bug 545756 - Fix initialization of constant expressions
- propagate associatedNumericalValue in sizeof() - set associatedNumericalValue from LiteralExpression Change-Id: Ibf1fdb70e7bbbb889113f337a0b12532c5040300 Signed-off-by: Hannes Vogt <hannes@havogt.de>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java27
1 files changed, 27 insertions, 0 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 43a8fd83eb2..37d4cb0e647 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
@@ -13009,4 +13009,31 @@ public class AST2CPPTests extends AST2CPPTestBase {
public void testBraceElisionForAggregateInit6_typedef_543038() throws Exception {
parseAndCheckBindings();
}
+
+ // struct type{
+ // int a;
+ // };
+ // type b{sizeof(type)};
+ public void testAggregateInitNoNarrowingConversionInConstContext_545756() throws Exception {
+ parseAndCheckImplicitNameBindings();
+ }
+
+ // struct type{
+ // int a;
+ // };
+ // const unsigned long v = 1;
+ // type b{v};
+ public void testAggregateInitNoNarrowingConversionInConstContext2_545756() throws Exception {
+ parseAndCheckImplicitNameBindings();
+ }
+
+ // struct type{
+ // int a;
+ // };
+ // unsigned long v = 1;
+ // type b{v};
+ public void testAggregateInitNarrowingConversion_545756() throws Exception {
+ BindingAssertionHelper bh = getAssertionHelper();
+ bh.assertImplicitName("b{v};", 1, IProblemBinding.class);
+ }
}

Back to the top