diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-11-02 03:57:34 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-11-02 03:57:34 +0000 |
commit | 0b460e6bf8e0c418558401acc4832538ed8b662b (patch) | |
tree | 410814dca6b97572b4a309bdab1883b86e3ec439 /compiler-rt/lib/xray/xray_interface_internal.h | |
parent | 76a3ace1f0897906f59166b341008cf386b9e1f9 (diff) | |
download | bcm5719-llvm-0b460e6bf8e0c418558401acc4832538ed8b662b.tar.gz bcm5719-llvm-0b460e6bf8e0c418558401acc4832538ed8b662b.zip |
Fix __libcpp_is_constructible for source types with explicit conversion operators.
Previously __libcpp_is_constructible checked the validity of reference
construction using 'eat<To>(declval<From>())' but this doesn't consider
From's explicit conversion operators. This patch teaches __libcpp_is_constructible
how to handle these cases. To do this we need to check the validity
using 'static_cast<To>(declval<From>())'. Unfortunately static_cast allows
additional base-to-derived and lvalue-to-rvalue conversions, which have to be
checked for and manually rejected.
While implementing these changes I discovered that Clang incorrectly
rejects `static_cast<int&&>(declval<float&>())` even though
`int &&X(declval<float&>())` is well formed. In order to tolerate this bug
the `__eat<T>(...)` needs to be left in-place. Otherwise it could be replaced
entirely with the new static_cast implementation.
Thanks to Walter Brown for providing the test cases.
llvm-svn: 285786
Diffstat (limited to 'compiler-rt/lib/xray/xray_interface_internal.h')
0 files changed, 0 insertions, 0 deletions