Bug 20875 – [REG2.087.1] Enum template specialization ignored

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-05-28T12:46:08Z
Last change time
2020-05-29T10:33:10Z
Keywords
pull
Assigned to
No Owner
Creator
Simen Kjaeraas

Comments

Comment #0 by simen.kjaras — 2020-05-28T12:46:08Z
enum Foo(alias T : None!U, U...) = true; enum Bar(alias T : None!U, U...) = false; static assert( Foo!(int)); static assert(!Bar!(int)); The above code should of course not compile - None is nowhere defined, so nothing can match, yet it does.
Comment #1 by dlang-bot — 2020-05-28T23:13:42Z
@NilsLankila created dlang/dmd pull request #11193 "fix issue 20875 - specialization ignored for template alias param use…" fixing this issue: - fix issue 20875 - specialization ignored for template alias param used with type The "regression" was introduced by https://github.com/dlang/dmd/pull/9769. The problem was actually more than the check for the template parameter specialization was not done yet, so this is more a new case of "accept invalid" than a "regression". This new check consists into verifying that a type passed to a template alias parameter implicitly converts to the one used as template specialization. In addition a new error is introduced, in case where the specialization would not be a type, since checking for implicit convertion makes no sense anymore. https://github.com/dlang/dmd/pull/11193
Comment #2 by dlang-bot — 2020-05-29T10:33:10Z
dlang/dmd pull request #11193 "fix issue 20875 - specialization ignored for template alias param use…" was merged into stable: - bcdf8523e73579748dc6ad86e41eb84526c156a1 by Nils Lankila: fix issue 20875 - specialization ignored for template alias param used with type The "regression" was introduced by https://github.com/dlang/dmd/pull/9769. The problem was actually more than the check for the template parameter specialization was not done yet, so this is more a new case of "accept invalid" than a "regression". This new check consists into verifying that a type passed to a template alias parameter implicitly converts to the one used as template specialization. In addition a new error is introduced, in case where the specialization would not be a type, since checking for implicit convertion makes no sense anymore. https://github.com/dlang/dmd/pull/11193