-e21c07e84bd9668e1c0fc1f45e514c5fd76988e7
+39edbe17e7b5c761d780c9d1d4376a06df7bf3d8
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
else if (vx->_init)
{
assert(!vx->_init->isVoidInitializer());
- e = vx->getConstInitializer(false);
+ if (vx->inuse) // https://issues.dlang.org/show_bug.cgi?id=18057
+ {
+ vx->error(loc, "recursive initialization of field");
+ errors = true;
+ e = NULL;
+ }
+ else
+ e = vx->getConstInitializer(false);
}
else
{
static assert(!foo17407);
+/**************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=18057
+// Recursive field initializer causes segfault.
+
+struct RBNode(T)
+{
+ RBNode!T *copy = new RBNode!T;
+}
+
+static assert(!__traits(compiles, { alias bug18057 = RBNode!int; }));
+
--- /dev/null
+/**
+TEST_OUTPUT:
+---
+fail_compilation/fail18057.d(16): Error: template instance RBNode!int `RBNode` is not a template declaration, it is a struct
+fail_compilation/fail18057.d(13): Error: variable fail18057.RBNode.copy recursive initialization of field
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=18057
+// Recursive field initializer causes segfault.
+struct RBNode
+{
+ RBNode *copy = new RBNode;
+}
+
+alias bug18057 = RBNode!int;
--- /dev/null
+/**
+TEST_OUTPUT:
+---
+fail_compilation/fail18057b.d(12): Error: variable `fail18057b.Recursive.field` recursive initialization of field
+---
+*/
+
+// https://issues.dlang.org/show_bug.cgi?id=18057
+// Recursive field initializer causes segfault.
+struct Recursive
+{
+ int field = Recursive();
+}