Bug 16478 – Don't allow to!T() in constraint

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-08T23:45:00Z
Last change time
2017-01-16T23:24:55Z
Keywords
pull
Assigned to
nick
Creator
john.loughran.colvin

Comments

Comment #0 by john.loughran.colvin — 2016-09-08T23:45:53Z
import std.variant; import std.conv; void main() { Algebraic!(bool[]) a = [true]; auto b = a.visit!(to!string); } std/conv.d(296): Error: template instance isRawStaticArray!() does not match template declaration isRawStaticArray(T, A...) std/variant.d(2214): Error: static assert "to(A...)(A args) if (!isRawStaticArray!A) is not a function or delegate" std/variant.d(1991): instantiated from here: visitImpl!(true, VariantN!(16LU, bool[]), to) visitError.d(6): instantiated from here: visit!(VariantN!(16LU, bool[])) seems like that first error shouldn't be happening.
Comment #1 by nick — 2016-11-12T12:31:46Z
PR pending. The error is because A.length can be zero: T to(A...)(A args) if (!isRawStaticArray!A)
Comment #2 by github-bugzilla — 2016-11-23T23:10:01Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/006ee446f886c5a0f8147908501d287236dd6197 Fix Issue 16478 - Don't allow to!T() in constraint Also avoid highlighting 'to' unnecessarily.
Comment #3 by github-bugzilla — 2016-11-25T02:18:54Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b46ca983f217cb319e94848cb168e246c1ac9f92 Fix Issue 16478 - Don't allow to!T() in constraint Use specialization to prefer to!S when S is a static array. https://github.com/dlang/phobos/commit/bad369cea4d89621c98226f9231380ff6e4778d7 Merge pull request #4922 from ntrel/to-empty-args Really fix Issue 16478 - Don't allow to!T() in constraint
Comment #4 by github-bugzilla — 2016-12-27T13:11:24Z
Commits pushed to scope at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/006ee446f886c5a0f8147908501d287236dd6197 Fix Issue 16478 - Don't allow to!T() in constraint https://github.com/dlang/phobos/commit/b46ca983f217cb319e94848cb168e246c1ac9f92 Fix Issue 16478 - Don't allow to!T() in constraint https://github.com/dlang/phobos/commit/bad369cea4d89621c98226f9231380ff6e4778d7 Merge pull request #4922 from ntrel/to-empty-args
Comment #5 by github-bugzilla — 2017-01-07T03:02:38Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/006ee446f886c5a0f8147908501d287236dd6197 Fix Issue 16478 - Don't allow to!T() in constraint https://github.com/dlang/phobos/commit/b46ca983f217cb319e94848cb168e246c1ac9f92 Fix Issue 16478 - Don't allow to!T() in constraint Use specialization to prefer to!S when S is a static array. https://github.com/dlang/phobos/commit/bad369cea4d89621c98226f9231380ff6e4778d7 Merge pull request #4922 from ntrel/to-empty-args
Comment #6 by github-bugzilla — 2017-01-16T23:24:55Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/006ee446f886c5a0f8147908501d287236dd6197 Fix Issue 16478 - Don't allow to!T() in constraint https://github.com/dlang/phobos/commit/b46ca983f217cb319e94848cb168e246c1ac9f92 Fix Issue 16478 - Don't allow to!T() in constraint https://github.com/dlang/phobos/commit/bad369cea4d89621c98226f9231380ff6e4778d7 Merge pull request #4922 from ntrel/to-empty-args