(x86 build error) ambiguous overloaded operator[] with handshake_input_buffers/handshake_output_buffers
leo-liu opened this issue · 2 comments
leo-liu commented
Building the wintls example with VS2022 on 32bit x86, it shows that there are some build error on overloaded operator[]
with type handshake_input_buffers
/handshake_output_buffers
. I also tried LLVM-cl with the same error. However, the x64 build is OK.
I inspected the code and found out the ambiguous overloaded functions are:
template <std::size_t N>
class sspi_buffer_sequence {
public:
//...
operator PSecBufferDesc() {
return &sec_buffer_desc_;
}
sspi_buffer& operator[](size_t i) {
return buffers_[i];
}
const sspi_buffer& operator[](size_t i) const {
return buffers_[i];
}
// ...
private:
SecBufferDesc sec_buffer_desc_;
};
Then a call to input_buffers_[0].pvBuffer
may cause a build error.
It seems that the bug is concealed by the different pointer size or integer size on x64.
leo-liu commented
Personally I think it is not a good idea to overload implicit conversion from sspi_buffer_sequence
to PSecBufferDesc
. The bug can be fixed by replacing operator PSecBufferDesc()
to an explicit function call.