Is there an "unused function parameter elimination optimization", when I use enabler as following:
template< typename T >
void f(T x, typename std::enable_if< some_predicate< T > >::type * = nullptr) { /* do something useful with x */; }
?
I mean, will generate extra code for void *
parameter passing (for example, for GCC 4.8 compiler)?
And what about in light of lto/ltcg presence?
Strictly, doing this violates the ABI, as far as I am aware- ie, some other compiler that did not optimize might pass in a value there.
However, in my experience, Clang has an immensely irritating habit of removing parameters it views as redundant- especially values of empty types. So I would suggest that the compiler might do if it can prove the value is unused.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.