www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17309] New: constructor template doesn't infer `pure`

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

          Issue ID: 17309
           Summary: constructor template doesn't infer `pure`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

Found by Russel Winder who posted to D.learn:
http://forum.dlang.org/post/mailman.1458.1491584811.31550.digitalmars-d-learn puremagic.com

----
struct BigInt
{
    this(Range)(Range s) {} /* `pure` should be inferred, but apparently isn't
*/
}

void main()
{
    auto y = immutable BigInt(""); /* rejected, should be accepted */
}
----

Exact error message:
----
test.d(8): Error: template test.BigInt.__ctor cannot deduce function from
argument types !()(string) immutable, candidates are:
test.d(3):        test.BigInt.__ctor(Range)(Range s)
----

--
Apr 08