[Issue 11326] New: move functions are not properly constrained and work improperly with templated functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 22 11:16:45 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11326
Summary: move functions are not properly constrained and work
improperly with templated functions
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: andrej.mitrovich at gmail.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-10-22 11:16:43 PDT ---
-----
import std.range;
struct NotRange
{
int moveAt(T)(T index) { return 0; }
}
struct Range
{
@property int front() { return 0; }
void popFront() { }
@property bool empty() { return false; }
int moveFront()() { assert(0); } // never called because it's a template!
}
void main()
{
NotRange nr;
// Internal error:
// std\range.d(6870): Error: template std.array.front does not match any
function template declaration. Candidates are:
// nr.moveFront();
Range r;
moveFront(r);
}
-----
Problems:
- Non-range types are accepted, leading to internal Phobos errors.
- moveFront/moveBack/moveTo check for the presence of a move function via the
address operator -- e.g. "static if (is(typeof(&r.moveFront)))", which will
fail for templated functions.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list