Skip to content

Commit

Permalink
Assertion failure: '0' on line 145 in file 'mtype.c
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 11, 2011
1 parent 1a2277c commit 56276cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mtype.c
Expand Up @@ -2200,6 +2200,12 @@ TypeError::TypeError()
{
}

Type *TypeError::syntaxCopy()
{
// No semantic analysis done, no need to copy
return this;
}

void TypeError::toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs)
{
buf->writestring("_error_");
Expand Down
1 change: 1 addition & 0 deletions src/mtype.h
Expand Up @@ -334,6 +334,7 @@ struct Type : Object
struct TypeError : Type
{
TypeError();
Type *syntaxCopy();

void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);

Expand Down
2 changes: 2 additions & 0 deletions test/fail_compilation/fail354.d
@@ -0,0 +1,2 @@
struct S(int N) { this(T!N) { } }
alias S!1 M;

3 comments on commit 56276cb

@yebblies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test fail without the patch? I don't think the autotester can distinguish between a compiler crash and a compiler error, I've had to use a static assert(!is(typeof())) test instead in some cases, to avoid having an always-fail test.

@braddr
Copy link
Member

@braddr braddr commented on 56276cb Dec 11, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fail tests do detect compiler crashes as a failure of the test. Only the compiler exiting via a normal exit and with return code 1 is a 'successful' failure mode test. See test/d_do_test.d in the execute function.

@yebblies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so it is. I guess my problem was due to something else.

Please sign in to comment.