www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16988] New: Ddoc doesn't recognize parameters in eponymous CT

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

--
Dec 19 2016