<div class="gmail_quote">On Tue, Feb 21, 2012 at 8:38 PM, Michel Morin <span dir="ltr"><<a href="mailto:mimomorin@gmail.com">mimomorin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> Log:<br>
> Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is a<br>
> function call (or a comma expression with a function call on its right-hand<br>
> side), possibly parenthesized, then the return type is not required to be<br>
> complete and a temporary is not bound. Other subexpressions inside a decltype<br>
> expression do not get this treatment.<br>
<br>
Is there any way to detect this C++11 decltype feature?<br>
`__has_feature(cxx_decltype)` does not work,<br>
since this macro also detects pre-N3276 decltype.<br>
(Boost.Config needs to detect N3276 decltype.)<br></blockquote></div><div><br></div><div>There's no __has_feature check for it, but it's pretty easy to detect with SFINAE (check for SFINAE access control first if you want to use this particular approach):</div>
<br><div>template<typename T, typename U></div><div>struct enable_if_type { typedef U type; };</div><div><br></div><div>template<typename T> false_type has_decltype_no_temp(...);</div><div>template<typename T> typename enable_if_type<decltype(T()), true_type>::type has_decltype_no_temp(int);</div>
<div><br></div><div>class S { ~S(); };</div><div>using has_feature_decltype_no_temp = decltype(has_decltype_no_temp<S>(0));</div><div><br></div><div>- Richard</div>