Thread overview
[Issue 16428] Better error message for pattern matching of value template parameters
[Issue 16428] Cannot pattern match value template parameter
Aug 25, 2016
John Colvin
Dec 17, 2022
Iain Buclaw
August 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16428

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com

--- Comment #1 from John Colvin <john.loughran.colvin@gmail.com> ---
Shouldn't that be:
static assert(is(typeof(a) == A!(T, x), T, T x));
? It still fails though :(

Workaround:
static assert(is(typeof(a) == A!(T, x), T, alias x));

--
August 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16428

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Cannot pattern match value  |Better error message for
                   |template parameter          |pattern matching of value
                   |                            |template parameters
           Severity|normal                      |enhancement

--- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> ---
Eh, "alias" is the way, not just a workaround. Thanks! I'll repurpose this.

--
August 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16428

--- Comment #3 from Andrei Alexandrescu <andrei@erdani.com> ---
The error message should be better. Currently:

static assert(is(A!(int, 42) == A!(T, x), __isexp_id52, T, x)) is false

Proposed:

static assert(is(A!(int, 42) == A!(T, x), T, x)) is false (did you mean "alias
x"?)

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16428

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--