-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3-parameter CommandLineOption constructor overloads are ambiguous #215
Comments
Hmmm, with the minimal example alone, this does show up on xenial, even though the original point of discovery (when modifying unity-system-compositor) did not. |
WebDrake
added a commit
to WebDrake/unity-system-compositor
that referenced
this issue
Mar 6, 2018
This method of handling `--version` removes some of the custom arguments handling blocking the transition to using `miral::MirRunner`. The explicit use of `std::function<void(bool)>` is required in order to avoid ambiguity about the compiler overload being invoked; for details, see canonical/mir#215.
WebDrake
added a commit
to WebDrake/unity-system-compositor
that referenced
this issue
Mar 6, 2018
This patch reworks the creation of the `DMConnection` instance used in USC, extracting it from the init callback added under the hood of the `SystemCompositor` class, and placing it instead in `main`, where it is instantiated using a collection of `CommandLineOption` instances. Most of the latter are implemented using `pre_init` just to ensure that the resulting values are set correctly before the display manager connection itself is instantiated; only the `--debug-without-dm` flag is not, since its callback is the one inside which the instantiation actually happens. (The use of `pre_init` for the others is probably overkill, but it can't hurt to make sure that these values are handled as early as possible.) This allows us to clean up some uses of `add_configuration_option` and so reduce the number of direct dependencies on the `mir::Server` API. We can also now remove the explicit `SystemCompositor` constructor, as the class no longer needs to access the session switcher. The explicit use of `std::function<void(bool)>` is required in order to avoid ambiguity about the compiler overload being invoked; for details, see canonical/mir#215.
Hmm... Why didn't this connect to PR #228 |
I think it may be that you need the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When building on bionic, I get compilation errors when trying to use the various 3-parameter overloads of the
CommandLineOption
constructor, i.e. those overloads that do not include adefault_value
parameter:https://github.com/MirServer/mir/blob/38ec6376284a88f94fd69f5c9e86fdc57a7a5a08/include/miral/miral/command_line_option.h#L72-L90
Specifically, if a lambda is provided to the constructor, the compiler appears unable to work out which
std::function<void(T)>
template instantiation is to be used.The following simple test program can be used to illustrate the problem:
(Build with e.g.
g++ -I/usr/include/mircore -I/usr/include/miral/ -c commandlineoption.cpp
to see the errors.)The problem
does not show up when building on xenial, anddoes not appear to be related to theg++
version in use.The best workaround I can find is to pass an explicit
std::function
instance to theCommandLineOption
compiler, e.g.:The text was updated successfully, but these errors were encountered: