Skip to content

Commit

Permalink
fix Issue 15079 - Assertion `fd->semanticRun == PASSsemantic3done' fa…
Browse files Browse the repository at this point in the history
…iled.

It was another surface of issue 15044, and fixed from 2.068.2 - the attribute inference problem had sent a function which is not yet completed semantic analysis to glue layer, and the breaking of internal invariance has been detected.
  • Loading branch information
9rnsr committed Sep 27, 2015
1 parent 3b02f50 commit 848ea9a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
50 changes: 50 additions & 0 deletions test/runnable/imports/a15079.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module imports.a15079;

Vector!string parseAlgorithmName()
{
assert(0);
}

struct Vector(ALLOC)
{
@disable this(this);

RefCounted!(Vector, ALLOC) dupr()
{
assert(0);
}
}

struct RefCounted(T, ALLOC)
{
~this()
{
T* objc;
.destroy(*objc);
}
}

// ----

void _destructRecurse(S)(ref S s)
if (is(S == struct))
{
static if (__traits(hasMember, S, "__xdtor") &&
__traits(isSame, S, __traits(parent, s.__xdtor)))
{
s.__xdtor();
}
}

void destroy(T)(ref T obj) if (is(T == struct))
{
_destructRecurse(obj);
() @trusted {
auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof];
auto init = cast(ubyte[])typeid(T).init();
if (init.ptr is null) // null ptr means initialize to 0s
buf[] = 0;
else
buf[] = init[];
} ();
}
5 changes: 5 additions & 0 deletions test/runnable/test15079.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module test15079;

import imports.a15079;

void main() {}

0 comments on commit 848ea9a

Please sign in to comment.