www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16599] New: Allow Template Constraint in Untemplated Function

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 puremagic.com
          Reporter: gyroheli 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.

--
Oct 06 2016