Thread overview
[Issue 20576] TemplateTypeParameter and TemplateValueParameter default values are not checked
[Issue 20576] TemplateTypeParameter default values are not checked
Feb 11
Basile-z
Feb 11
Basile-z
Feb 12
Basile-z
Feb 20
Basile-z
Feb 20
Basile-z
February 11
https://issues.dlang.org/show_bug.cgi?id=20576

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
TemplateValueParameter too:

---
void foo(ubyte u = 0xFF1)()
{
}

void main()
{
    foo!1();
}
---

--
February 11
https://issues.dlang.org/show_bug.cgi?id=20576

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|TemplateTypeParameter       |TemplateTypeParameter and
                   |default values are not      |TemplateValueParameter
                   |checked                     |default values are not
                   |                            |checked

--
February 12
https://issues.dlang.org/show_bug.cgi?id=20576

Mathias LANG <pro.mathias.lang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang@gmail.com

--- Comment #2 from Mathias LANG <pro.mathias.lang@gmail.com> ---
I'm not sure that's an issue.

In trivial cases like this the code is obviously wrong, but the only way we're going to realistically catch all these is by always instantiating the template with default parameters, which is 1) not always possible, 2) a waste of compilation time.

--
February 12
https://issues.dlang.org/show_bug.cgi?id=20576

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor

--- Comment #3 from Basile-z <b2.temp@gmx.com> ---
I agree about the waste of time but keep the issue opened, just to be clear on the fact that the problem is already known.

--
February 20
https://issues.dlang.org/show_bug.cgi?id=20576

--- Comment #4 from Basile-z <b2.temp@gmx.com> ---
other example:

struct Foo {
    Foo opBinary(string op="-")(Foo f) {
        return Foo();
    }
}
void main() {
    auto Foo = Foo() + Foo();
}

--
February 20
https://issues.dlang.org/show_bug.cgi?id=20576

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc

--- Comment #5 from Basile-z <b2.temp@gmx.com> ---
*** Issue 8844 has been marked as a duplicate of this issue. ***

--