mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/const: fixes for disambiguating calls to const methods
This commit is contained in:
parent
8da51d61f5
commit
7b5db7c7ea
@ -601,13 +601,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
} else if m.ReturnType.QtClassType() && !m.ReturnType.Pointer {
|
||||
// Still need const/nonconst in order to properly call function overloads that are only disambiguated by const-ness
|
||||
// e.g. QCborArray::begin() can return an Iterator or a ConstIterator
|
||||
if m.IsConst {
|
||||
shouldReturn = "const " + m.ReturnType.ParameterType + " ret = "
|
||||
} else {
|
||||
shouldReturn = m.ReturnType.ParameterType + " ret = "
|
||||
}
|
||||
shouldReturn = m.ReturnType.ParameterType + " ret = "
|
||||
afterCall = "\t// Copy-construct value returned type into heap-allocated copy\n"
|
||||
afterCall += "\treturn static_cast<" + m.ReturnType.ParameterType + "*>(new " + m.ReturnType.ParameterType + "(ret));\n"
|
||||
|
||||
@ -631,6 +625,9 @@ extern "C" {
|
||||
callTarget := "self->"
|
||||
if m.IsStatic {
|
||||
callTarget = c.ClassName + "::"
|
||||
|
||||
} else if m.IsConst {
|
||||
callTarget = "const_cast<const " + c.ClassName + "*>(self)->"
|
||||
}
|
||||
|
||||
ret.WriteString(fmt.Sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user