Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Vogt2019-04-30 06:26:20 +0000
committerHannes Vogt2019-05-20 18:49:26 +0000
commit1cd0e1df35696e143697533ad3b1b35171d0670a (patch)
tree966419534ded56c3b304ec0c08abbcd971f7ac43 /core/org.eclipse.cdt.core.tests
parentf938b4d08e59c67309cb0fac1e2bbc8dc1acfa90 (diff)
downloadorg.eclipse.cdt-1cd0e1df35696e143697533ad3b1b35171d0670a.tar.gz
org.eclipse.cdt-1cd0e1df35696e143697533ad3b1b35171d0670a.tar.xz
org.eclipse.cdt-1cd0e1df35696e143697533ad3b1b35171d0670a.zip
Bug 546805 - Infinite recursion in self-aggregation
Protects for infinite recursion in case the type (illegally) aggregates itself. Change-Id: I2e70f85a73b3d2ed6fec432fa2f768f2bcf8d1bf 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.java26
1 files changed, 26 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 111203a785d..eae38c57ac0 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
@@ -13342,4 +13342,30 @@ public class AST2CPPTests extends AST2CPPTestBase {
BindingAssertionHelper helper = getAssertionHelper();
helper.assertVariableValue("is_not_noexcept", 0);
}
+
+ // struct B{
+ // B a;
+ // };
+ // B t{1};
+ public void testSelfAggregation_546805() throws Exception {
+ // Note that ideally we would report an error already on the declaration of B as
+ // the class is aggregating itself. Today, we only report an error because of a
+ // wrong constructor argument.
+ BindingAssertionHelper bh = getAssertionHelper();
+ bh.assertImplicitName("t{1};", 1, IProblemBinding.class);
+ }
+
+ // struct B;
+ // struct A{
+ // B b;
+ // };
+ // struct B{
+ // A a;
+ // };
+ // B t{1};
+ public void testIndirectSelfAggregation_546805() throws Exception {
+ // See comment in previous test
+ BindingAssertionHelper bh = getAssertionHelper();
+ bh.assertImplicitName("t{1};", 1, IProblemBinding.class);
+ }
}

Back to the top