Using std::is_convertible with a pointer to class which contains an incomplete type, and the is_convertible_to is not used (gcc / _LIBCPP_USE_IS_CONVERTIBLE_FALLBACK), is resulting in ADL. Making __test_convert qualified avoid this.
Details
Diff Detail
Event Timeline
This changes was tested on a 64bit Linux host building llvm with gcc-5.3+libc++, and saw no change to regression runs with gcc-4.8.5, gcc-4.9.3, gcc-5.3, clang-3.4 and clang-3.7.1
Thanks for the patch! The test case looks good and properly exercises the bug.
However there are a few things that need to be cleaned up. Sorry for the nit-picky review.
include/type_traits | ||
---|---|---|
1350 | The problem here is that __test_convert is un-qualified so ADL is performed. This seems to instantiate Forward* as seen in your test. Fully qualifying this call has the same effect as your entire patch. decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>())) Since I'm not sure that using a constructor is semantically equivalent using a function I would prefer this change instead. | |
test/std/utilities/meta/meta.rel/is_convertible.pass.cpp | ||
59 | This test type can be implemented in a clearer manner. The purpose of Forward is that it causes a compilation error when instantiated. However that's not immediately clear from the name or implementation. I would go with something like: template <typename T> class CannotInstantiate { enum { X = T::ThisExpressionWillBlowUp }; }; | |
205 | This change is incorrect. We want to run this test in the following configurations:
The second case is handled by the bit of code you removed.
| |
215 | Can you describe what this test is doing a little more? For example:
|
LGTM after addressing the IncompleteClass comment.
Thanks for the patch!
test/std/utilities/meta/meta.rel/is_convertible.pass.cpp | ||
---|---|---|
216 | CannotInstantiate<int>* works too. Using IncompleteClass seems a little distracting because it has nothing to do with the class being incomplete. |
I dont have commit access, so if the change still looks good, and someone is feeling generous.. :)
The problem here is that __test_convert is un-qualified so ADL is performed. This seems to instantiate Forward* as seen in your test. Fully qualifying this call has the same effect as your entire patch.
Since I'm not sure that using a constructor is semantically equivalent using a function I would prefer this change instead.