www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4513] New: Unclear template template error message

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4513

           Summary: Unclear template template error message
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-07-26 13:57:48 PDT ---
This is a wrong D2 program, bar() takes as first template argument a struct
template (to work it misses the commented out 'alias' at F):


struct Foo(T) {
    T value;
}
F!T bar(/*alias*/ F, T)(T value) {
    return F!T(value);
}
void main() {
    auto b1 = bar!Foo(1); // line 8
}


dmd 2.047 prints the error messages:
test.d(8): Error: template test.bar(F,T) does not match any function template
declaration
test.d(8): Error: template test.bar(F,T) cannot deduce template function from
argument types !(Foo)(int)
test.d(8): Error: template instance errors instantiating template


But those error messages are too many and they don't tell what the problem is
or how to fix the code. They are not helping much. If this is possible a better
error message can be something like:

test.d(8): Error: in template test.bar(F,T) template template argument 'F'
needs 'alias'.

Or something like:

test.d(8): Error: in template test.bar(F,T) template template argument 'Foo'
passed to 'F' needs 'alias'.

Or something related.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4513


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013