Consider:
struct A(T, T x = 42) {}
A!(int, 42) a;
static assert(is(typeof(a) == A!(T), T));
static assert(is(typeof(a) == A!(T, x), T, x));
The second assertion fails.
Comment #1 by john.loughran.colvin — 2016-08-25T15:07:49Z
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));
Comment #2 by andrei — 2016-08-25T15:37:20Z
Eh, "alias" is the way, not just a workaround. Thanks! I'll repurpose this.
Comment #3 by andrei — 2016-08-25T15:39:37Z
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"?)
Comment #4 by robert.schadek — 2024-12-13T18:49:44Z