D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4570 - ElementType!(void[]) shows error message.
Summary: ElementType!(void[]) shows error message.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-02 03:00 UTC by SHOO
Modified: 2010-08-05 07:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SHOO 2010-08-02 03:00:40 UTC
This code displays an error:

-------------- main.d ----------------------
import std.range;
pragma(msg, ElementType!(void[]));
------------------------------------
dmd -c main
void
std\array.d(357): Error: [i] has no effect in expression (a[0u])

I think that this error message should be removed.


If there is not an objection, I rewrite ElementType template as this:
------------------------------------
template ElementType(R)
{
    static if (is(typeof({return R.init.front();}()) T))
        alias T ElementType;
    else
        alias void ElementType;
}
------------------------------------
Comment 1 SHOO 2010-08-05 07:19:06 UTC
Fixed.

See also: http://www.dsource.org/projects/phobos/changeset/1809