Closed zachcran closed 2 years ago
Does this work for any type? I'd have assumed that the type of returns is always going to be desc
since you need to provide the name of the variable to assign the result to, not the type of the result. You have to document what the result's type is.
FWIW, because of how CMake itself works the type system ends up being a bit underwhelming (lots of desc
and str
). That said, I found its main use to be catching when you're given a list and weren't expecting one or vice versa.
Ah, I was probably just thinking about it wrong then. It makes sense that the type of returns would always be desc
with your explanation. I was thinking about the type that the variable would be holding, which you would just put in the documentation. It is probably worthwhile to add that explanation explicitly in the documentation, so I'll do that when I get a chance and tie it to this issue to close it.
Describe the bug When a class member function is defined with a boolean output variable, an overload error is thrown saying there is no suitable overload of the function because the blank output variable is deteremined to be of type
desc
, notbool
. For example, a method defined ascpp_member(foo ExampleClass bool)
called asExampleClass(foo "${my_obj}" return_value)
will throw the errorNo suitable overload of foo(exampleclass, desc)
.It seems that this is an issue any time the parameter that should be a
bool
does not actually contain a validbool
.To Reproduce Steps to reproduce the behavior:
ExampleClass
, with a method of the signaturecpp_member(foo ExampleClass bool)
. The function does not have to do anything, but you could set the return value toTRUE
and return it for a full example.foo()
as if you are getting a return value.Expected behavior I would expect a boolean value to be returned without errors. I am pretty sure that
cpp_member(foo ExampleClass bool)
is a valid function signature.Additional context I do not see this error for input boolean parameters if the input variable is a valid boolean. Here is a complete program to reproduce the issue: