Summary: wrong file name in error message for "voids have no
                    value" inside alias templates (affects
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Rob Jacques <> 2010-10-18 17:28:42 PDT ---
There seems to be an issue with the reported filename for alias templates that
create a variable of type void. Here is a test case:

using DMD 2.049:

import std.algorithm;
void main(string[] args) {
    auto foobar  = map!( (int i){} )([0]); // using a named delegate also

results in the error message

hello.d, Line 119
Error: variable hello.main.Map!(__dgliteral1,int[]).Map._cache voids have no

Line 119 of std.algorithm (part of the Map struct):
Unqual!ElementType _cache;

This may be related to issue 2180.

Here is a reduced test case that gives a slightly better set of error messages
than the std.algorithm example:

import std.stdio: writeln;
import goodbye;

void main(string[] args) {
    auto foobar  = map!( (int i){} )(5);

module goodbye;

// line 9
template map(fun...)            //
    auto map(Range)(Range r)
        return Map!(fun)(r);    // line 14, must instantiate with fun or r not

struct Map(alias fun) {         // Must be an alias template
    void _cache;                // line 19

Error messages produced:

hello.d Line 19
Error: variable hello.main.Map!(delegate void(int i)
hello.d Line 14
Error: template instance hello.main.Map!(delegate void(int i)
hello.d Line 5
instantiated from here: map!(int)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to