Author: ericwf
Date: Wed May 18 17:23:46 2016
New Revision: 269991

URL: http://llvm.org/viewvc/llvm-project?rev=269991&view=rev
Log:
Optimize declval for compile times. Patch from Eric Niebler.

This patch implements the C++11 version of declval without requiring a template
instantiation.

See PR27798 for more information. https://llvm.org/bugs/show_bug.cgi?id=27798

Modified:
    libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=269991&r1=269990&r2=269991&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Wed May 18 17:23:46 2016
@@ -1095,8 +1095,11 @@ template <class _Tp> using add_rvalue_re
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
+template <class _Tp> _Tp&& __declval(int);
+template <class _Tp> _Tp   __declval(long);
+
 template <class _Tp>
-typename add_rvalue_reference<_Tp>::type
+decltype(_VSTD::__declval<_Tp>(0))
 declval() _NOEXCEPT;
 
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to