Open
Description
Describe the bug
Disclaimer: Not a C++ expert, please amend the description if incorrect
To Reproduce
#[test]
fn test_reference_const_char_cast() {
let hdr = indoc! {"
#include <cstddef>
class Bytes {
public:
typedef char value_type;
typedef std::size_t size_type;
typedef const char& reference;
private:
const value_type *d_ptr;
size_type d_length;
public:
reference front() const;
};
inline Bytes::reference Bytes::front() const
{
return d_ptr[0];
}
"};
let rs = quote! {};
run_test("", hdr, rs, &["Bytes"], &[]);
}
Fails with:
target/cxx/gen0.cxx:137:26: error: cannot initialize a variable of type 'const char *(Bytes::*)() const' with an rvalue of type 'Bytes::reference (Bytes::*)() const': different return type ('const char *' vs 'Bytes::reference' (aka 'const char &')) char const *(::Bytes::*front$)() const = &::Bytes::front;
This example taken from a vendor library header (and minimised).
Expected behavior
It compiles and returns a reference.
Additional context
Apologies if this is actually the same issue as something else - I tried to search the issues and this seems original.