www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13498] New: Return type is not checked in function template

https://issues.dlang.org/show_bug.cgi?id=13498

          Issue ID: 13498
           Summary: Return type is not checked in function template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: sinkuu aol.jp

Introduced by https://github.com/D-Programming-Language/dmd/pull/3979

The code below compiles with DMD v2.067-devel-5606406.


int test1()()
{
    return "foo"; // should fail as well
}

/+
int test2()
{
    return "foo"; // Error: cannot implicitly convert expression ("foo") of
type string to int
}
+/

void main()
{
    test1();
}

--
Sep 19 2014