Bug 16428 – Better error message for pattern matching of value template parameters

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-25T14:34:28Z
Last change time
2024-12-13T18:49:44Z
Assigned to
No Owner
Creator
Andrei Alexandrescu
Moved to GitHub: dmd#19179 →

Comments

Comment #0 by andrei — 2016-08-25T14:34:28Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19179 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB