[Issue 6404] New: Cannot check ref-ness of auto ref parameter in template constraint
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 29 22:20:47 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6404
Summary: Cannot check ref-ness of auto ref parameter in
template constraint
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-07-29 22:20:45 PDT ---
Cannot compile following code:
// receive only rvalue
void rvalue(T)(auto ref T x) if (!__traits(isRef, x)) {}
// receive only lvalue
void lvalue(T)(auto ref T x) if ( __traits(isRef, x)) {}
void main()
{
int n;
static assert(!__traits(compiles, rvalue(n)));
static assert( __traits(compiles, rvalue(0)));
static assert( __traits(compiles, lvalue(n)));
static assert(!__traits(compiles, lvalue(0)));
}
--
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