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

tcl getters accessing a const reference crash with a SIGSEGV #19

Closed
wfjm opened this issue Feb 17, 2019 · 1 comment
Closed

tcl getters accessing a const reference crash with a SIGSEGV #19

wfjm opened this issue Feb 17, 2019 · 1 comment
Assignees
Labels

Comments

@wfjm
Copy link
Owner

wfjm commented Feb 17, 2019

tcl commands like

  cpu0 get type
  cpu0rka get class
  rlc get timeout

crash with a SIGSEGV. Apparently all getters which internally return a const reference are affected. Observed with gcc 5.4.0. Unclear whether this is a coding bug introduced when boost::bind was replaced by lambdas (in commit 1620ee3) or a compiler issue.

@wfjm wfjm self-assigned this Feb 17, 2019
wfjm added a commit that referenced this issue Mar 3, 2019
- automatic return type detection for lambda's can be error prone
- it is safer and more compact to use std:bind as method forwarder
- closes issue #19
@wfjm
Copy link
Owner Author

wfjm commented Mar 3, 2019

The culprit was that automatic return type determination for the getter lambdas was used. This fails when the called method returns a reference of an object. The deduced lambda return type will the object, not a reference. Unfortunately this doesn't lead to a compile time error but to a run time error.

Bottom lime is

  • automatic return type detection for lambda's can be error prone
  • it is safer and also more compact to use std:bind as method forwarder

Fixed with commit 6024dce.

@wfjm wfjm closed this as completed Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant