[Issue 7511] attribute inference does not work for methods of templated aggregates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 17 07:26:37 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7511


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-02-17 07:26:36 PST ---
I think this is an enhancement.

Current attribute inference only works against template function and function
literal, not against normal function.
And non-template function insinde templated aggregate is normal function, so
the inference does not run for them.

But this is a big issue. Almost ranges in std.range should *inherit* original
range's pureness, safety, and nothrow-ness.
To implement it, with current compiler, the only way is to change *all of
member functions* in range structs to be tamplated like follows:

struct Retro(R) {
  R original;

  //auto empty(){ return original.empty; }
  auto empty()(){ return original.empty; }

  //auto front(){ return original.front; }
  auto front()(){ return original.front; }
  ...
}

...but it may introduce mess and dangerous forward reference, IMHO.

-- 
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