D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6424 - std.traits.hasElaborateAssign is limited
Summary: std.traits.hasElaborateAssign is limited
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-08-01 07:34 UTC by Kenji Hara
Modified: 2011-08-05 22:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011-08-01 07:34:47 UTC
Follwing code should compile:

struct S
{
  void opAssign(T)(auto ref T rhs)
    if (!__traits(isRef, rhs))
  {}
}
static assert(hasElaborateAssign!S);

Because hasElaborateAssign!T checks is(typeof(T.init.opAssign(T.init))),
but T.init is always lvalue, so S cannot pass its test.