[Issue 2026] New: Misleading error message when passing non-existent symbol to template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 23 13:42:18 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2026

           Summary: Misleading error message when passing non-existent
                    symbol to template
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: andrei at metalanguage.com


Prompted by a post by Bryan Myers:

import std.string;
import std.algorithm;

void main(char[][] args)
{
    string[] words = ["c", "ab", "bb"];
    sort!("a < b", SortStrategy.stable)(words);
    assert(words == ["ab", "bb", "c"]);
}

The code uses the non-existent symbol SortStrategy.stable instead of the
correct SwapStrategy.stable. However, the error message implies that the symbol
does exist and has type int:

/home/andrei/test.d(8): template std.algorithm.sort(alias less,SwapStrategy ss
= SwapStrategy.unstable,alias iterSwap = .iterSwap,Range) does not match any
function template declaration
/home/andrei/test.d(8): template std.algorithm.sort(alias less,SwapStrategy ss
= SwapStrategy.unstable,alias iterSwap = .iterSwap,Range) cannot deduce
template function from argument types !("a < b",int)(invariant(char)[][])


-- 



More information about the Digitalmars-d-bugs mailing list