https://llvm.org/bugs/show_bug.cgi?id=27798
Bug ID: 27798 Summary: declval() can be implemented without requiring a template instantiation. Product: libc++ Version: unspecified Hardware: PC OS: All Status: NEW Severity: enhancement Priority: P Component: All Bugs Assignee: unassignedclangb...@nondot.org Reporter: enieb...@boost.org CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com Classification: Unclassified declval gets used *everywhere*. It doesn't need to instantiate a template. Rather than: template <class _Tp> typename add_rvalue_reference<_Tp>::type declval() noexcept; declval can be defined as: template<typename _Tp, typename _Up = _Tp&&> _Up __declval(int); template<typename _Tp> _Tp __declval(long); template<typename _Tp> auto declval() noexcept -> decltype(__declval<_Tp>(0)); In a large code base that makes heavy use of templates, this small change is a measured 2% compile-time win. I think the as-if rule gives implementers enough latitude to make this change. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs