Skip to content
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

Fix clang build #112

Merged
merged 1 commit into from Sep 14, 2020
Merged

Fix clang build #112

merged 1 commit into from Sep 14, 2020

Conversation

Siborgium
Copy link
Collaborator

Should fix #109

@nwg-piotr nwg-piotr merged commit 520b77a into nwg-piotr:master Sep 14, 2020
@jbeich
Copy link
Contributor

jbeich commented Sep 15, 2020

Clang would've accepted [foo] -> [foo = foo] (capture by copy) as well:

--- a/grid/grid_tools.cc
+++ b/grid/grid_tools.cc
@@ -201,8 +201,8 @@ std::optional<DesktopEntry> desktop_entry(std::string&& path, const std::string&
             auto [ok, pos] = try_strip_prefix(prefix);
             if (ok) {
                 std::visit(visitor {
-                    [dest, pos, &view](nop_t) { *dest = view.substr(pos); },
-                    [dest, pos, &view](cut_t) {
+                    [dest = dest, pos = pos, &view](nop_t) { *dest = view.substr(pos); },
+                    [dest = dest, pos = pos, &view](cut_t) {
                         auto idx = view.find(" %", pos);
                         if (idx == std::string_view::npos) {
                             idx = std::size(view);

@Siborgium
Copy link
Collaborator Author

Siborgium commented Sep 16, 2020

The issue with clang is not copying, it's that variables inside of structured bindings are not exactly variables. However, your solution is much cleaner. I'll use it in my local copy and hopefully merge into master with the next PR. Thanks!

@nwg-piotr
Copy link
Owner

@Siborgium do not forget to sync other PRs merged lately.

Siborgium added a commit to Siborgium/nwg-launchers that referenced this pull request Sep 18, 2020
 - apply patch from nwg-piotr#112 (comment)
 - remove `DesktopEntry::no_display` field
 - store `exec`s and `DesktopEntry`s separately
 - introduce barebones `Span`
Siborgium added a commit to Siborgium/nwg-launchers that referenced this pull request Sep 18, 2020
 - apply patch from nwg-piotr#112 (comment)
 - remove `DesktopEntry::no_display` field
 - store `exec`s and `DesktopEntry`s separately
 - introduce barebones `Span`
Siborgium added a commit to Siborgium/nwg-launchers that referenced this pull request Sep 18, 2020
 - apply patch from nwg-piotr#112 (comment)
 - remove `DesktopEntry::no_display` field
 - store `exec`s and `DesktopEntry`s separately
 - introduce barebones `Span`
 - change `num_col` type `int` -> `std::size_t`
 - restore matching with `exec` (search)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to build with Clang
3 participants