[Issue 16988] New: Ddoc doesn't recognize parameters in eponymous CT templates

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Dec 19 16:17:36 PST 2016


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

          Issue ID: 16988
           Summary: Ddoc doesn't recognize parameters in eponymous CT
                    templates
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: greeenify at gmail.com

The following example will trigger an error with dmd:

```
/++
Multiplies the stride of the selected dimension by a factor.
Params:
    slice = input slice
    Dimensions = indexes of dimensions to be strided
    factors = list of step extension factors
    factor = step extension factors
Returns:
    n-dimensional slice of the same type
+/
template strided(Dimensions...)
    if (Dimensions.length)
{
    static if (1 == 2)
        auto strided(size_t N, Range)(Slice!(N, Range) slice,
Repeat!(Dimensions.length, size_t) factor){}
    else
        auto strided(size_t N, Range)(Slice!(N, Range) slice,
Repeat!(Dimensions.length, size_t) factors){}
}
```

with `dmd -w -D` yields:

```
foo.d(11): Warning: Ddoc: function declaration has no parameter 'slice'
foo.d(11): Warning: Ddoc: function declaration has no parameter 'factors'
foo.d(11): Warning: Ddoc: function declaration has no parameter 'factor'
```

without the static if it works fine.

--


More information about the Digitalmars-d-bugs mailing list