godotengine / godotengine/godot-cpp

register_signal with only the name argument causes ambiguity, which makes the default parameter pointless

Open
#431 0 comments 9 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

Currently `register_signal` has two overloads:
```cpp
template
void register_signal(String name, Dictionary args = Dictionary())
```
and
```cpp
template
void register_signal(String name, Args... varargs)
```

I believe the intention of `Dictionary args = Dictionary()` is to make that you can call `register_signal` with only one argument. But with the varadic template overload, that causes ambiguity, which forces me to use `register_signal("name", Dictionary::make())`, defeating the point of the default parameter.

Consider removing the default parameter, and just let the varadic template verison do its job?

Platform: windows10
Compiler: MSVC (Visual studio 2019)
Godot verison: 3.2.2
(I'm not sure if this is a MSVC-specific issue, but I think this is specified in the standard)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.