On 08/16/14 12:41, Mike via D.gnu wrote: > On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via D.gnu wrote: >> >> Taking the address of an always_inline function is allowed. >> > > It may be allowed, but it probably shouldn't be. Always-inlining a function > and taking the address of that function is contradictory.
Address-of should work -- disallowing it wouldn't help much, but would create problems for code that needs to call the function both directly and indirectly. This is actually a larger problem for D than for C (where it's allowed) because of generic code, templates and delegates. The alternative would be requiring trivial not-@inline wrappers and compile failures if one is accidentally forgotten. A `@nocode` attribute would be a good idea, yes, but there's no need to make it implicit for `@inline`. > But this situation demonstrates why having an intelligent linker is a better > solution than decorating with attributes. The linker should know if you took > an address of an always-inlined function or not and decide whether or not to > remove it from the binary. It already does. Apparently there are some kind of problems with certain setups, but, instead of addressing those problems, more and more /language/ hacks are proposed... artur