[Issue 16599] New: Allow Template Constraint in Untemplated Function in Templated Struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Oct 6 06:49:38 PDT 2016


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

          Issue ID: 16599
           Summary: Allow Template Constraint in Untemplated Function in
                    Templated Struct
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: gyroheli at gmail.com

Basically to allow template constraints like below, which currently causes an
error, saying a semicolon is expected not if statement.

    struct Templ(T)
    {
        void func() if(is(T == float)) // behavior now: Error: semicolon
expected...
        {
        }
    }

It's a bit cleaner than having a "static if" wrap the entire function.

--


More information about the Digitalmars-d-bugs mailing list