Our implementation rejects this well-formed program (derived from the libc++ test that fails because of this bug):
#include <algorithm>
#include <iterator>
struct incomplete;
template <class T>
struct wrapper {
T t;
};
int main() {
wrapper<incomplete>* some_pointers[42]{};
std::sort(std::begin(some_pointers), std::end(some_pointers));
}
by trying to instantiate wrapper<incomplete> despite that such instantiation is not necessary. The unqualified call to _Adl_verify_range(_First, _Last) (which appears in most algorithms, std::sort is simply an exemplar) necessitates instantiation of wrapper<incomplete> when _First has type wrapper<incomplete>**.
The problem runs deeper than simply _STD-qualifying _Adl_verify_range:
- the machinery it uses presumably makes other unqualified calls that will need to be dealt with, and
- the unqualified call to
_Verify_range should be avoided when the arguments are pointers.
Our implementation rejects this well-formed program (derived from the libc++ test that fails because of this bug):
by trying to instantiate
wrapper<incomplete>despite that such instantiation is not necessary. The unqualified call to_Adl_verify_range(_First, _Last)(which appears in most algorithms,std::sortis simply an exemplar) necessitates instantiation ofwrapper<incomplete>when_Firsthas typewrapper<incomplete>**.The problem runs deeper than simply
_STD-qualifying_Adl_verify_range:_Verify_rangeshould be avoided when the arguments are pointers.