D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11317 - glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.
Summary: glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice, pull
Depends on:
Blocks: 11322
  Show dependency treegraph
 
Reported: 2013-10-21 12:55 UTC by rswhite4
Modified: 2013-11-15 23:25 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description rswhite4 2013-10-21 12:55:05 UTC
struct Test {
public:
	@property
	auto ref uint length() const pure nothrow {
		return 0;
	}
	
	@property
	void length(uint len) {
	
	}
}

void main()
{
	Test t;
	t.length += 2;
}

Throws:
/d259/f777.d(7): Error: constant 0u is not an lvalue
dmd: glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.

with dmd 2.063.2
Comment 1 yebblies 2013-11-14 04:57:43 UTC
void test11317()
{
    auto ref uint fun11317()
    {
        return 0;
    }
    assert(fun11317() == 0);
}

fun11317 is correctly inferred to be non-ref, but the glue layer (seeing that tf->isref is true) tries to take the address of it anyway.  Hence the error, which causes the ice.

https://github.com/D-Programming-Language/dmd/pull/2763
Comment 2 github-bugzilla 2013-11-14 12:44:32 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/9ba50eecb45ce883130f36a96408dac767b276f0
fix Issue 11317 - glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.

Make ref-ness deduction and return type inference orthogonal.

https://github.com/D-Programming-Language/dmd/commit/38c51e74395c2daede20474c656477a75fafbeb7
Merge pull request #2766 from 9rnsr/fix11317

Issue 11317 - glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.
Comment 3 Kenji Hara 2013-11-15 23:25:26 UTC
Merged pull request: https://github.com/D-Programming-Language/dmd/pull/2766