1711 – typeof with delegate literal not allowed as template parameter

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1711 - typeof with delegate literal not allowed as template parameter
Summary: typeof with delegate literal not allowed as template parameter
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: Walter Bright
URL:
Keywords: rejects-valid
Depends on:
Blocks:
Reported: 2007年12月02日 18:32 UTC by Neia Neutuladh
Modified: 2015年06月09日 01:14 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Neia Neutuladh 2007年12月02日 18:32:02 UTC
template strof (T) {
 static string strof = T.stringof;
}
void main () {
 alias typeof(delegate () { return (invariant(char)[]).init;} ) del;
 // doesn't affect aliased type
 auto a = strof!(del);
 // doesn't affect non-delegate literal types
 auto aa = strof!(int);
 // doesn't affect non-delegates with typeof
 auto ab = strof!(typeof(5));
 // doesn't affect typeof with assigned variable
 auto meth = delegate () { return (invariant(char)[]).init;};
 auto b = strof!(typeof(meth));
 // rejects with delegate literal in typeof -- both of the following fail
 auto c = strof!(typeof(delegate () { return 5; } ));
 auto d = strof!(typeof(delegate () { return (invariant(char)[]).init;} ));
}
Comment 1 Walter Bright 2008年02月16日 06:02:13 UTC
Fixed dmd 1.026 and 2.010


AltStyle によって変換されたページ (->オリジナル) /