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

stlab::async will not accept non-const reference parameters #80

Closed
ahcox opened this issue Aug 17, 2017 · 6 comments
Closed

stlab::async will not accept non-const reference parameters #80

ahcox opened this issue Aug 17, 2017 · 6 comments
Milestone

Comments

@ahcox
Copy link

ahcox commented Aug 17, 2017

std::async() allows passing non-const reference parameters by wrapping them in std::ref. stlab::async() fails to compile if given non-const reference parameters, whether naked or wrapped in std::ref.

Platform and Toolchain

  • MacOS Sierra 10.12.5
  • clang: Apple LLVM version 8.1.0 (clang-802.0.42)
  • stlab built with homebrew and xcode 8.3.3 following install instructions and using the develop branch July 25 head.
  • repro code built in CLion 2016.2.2.
  • Fails when compiled with any of these flags -std=c++1z, -std=c++14, -std=c++11.

Selected extracts from Clion build of repro with -v flag

Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name async_error_repro2.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 278.4 -v -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -coverage-file /Users/ahcox/Library/Caches/CLion2016.2/cmake/generated/stlab_experiments-e68879c1/e68879c1/Debug/CMakeFiles/async_error_repro2.dir/async_error_repro2.cpp.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/ahcox/checkouts/stlab -I /Users/ahcox/.conan/data/Boost/1.60.0/lasote/stable/package/4224f719ca8cda8602a34d6a7dcc57685612aec9/include -stdlib=libc++ -std=c++1z -fdeprecated-macro -fdebug-compilation-dir /Users/ahcox/Library/Caches/CLion2016.2/cmake/generated/stlab_experiments-e68879c1/e68879c1/Debug -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o CMakeFiles/async_error_repro2.dir/async_error_repro2.cpp.o -x c++ /Users/ahcox/checkouts/stlab_experiments/async_error_repro2.cpp
clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.6.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
...
#include <...> search starts here:
 /Users/ahcox/checkouts/stlab
 /Users/ahcox/.conan/data/Boost/1.60.0/lasote/stable/package/4224f719ca8cda8602a34d6a7dcc57685612aec9/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory)
...

Repro

A simple example showing this is here: https://gist.github.com/ahcox/0e76d32a0a87ac24160bf50298052a1d
The log from the compile failure is here: https://gist.github.com/ahcox/9ce507f383ec7820fc245f9ea90297ee

@sean-parent
Copy link
Member

Already fixed on develop branch.

@sean-parent
Copy link
Member

Reopened - bug doesn't specify platform and if still repeatable in develop branch could be an issue with a platform executor.

@ahcox
Copy link
Author

ahcox commented Aug 18, 2017

Hi,
I built against the develop branch and updated the description with more info and this new repro and failing compile log.
Does my minimal repro example build fine for you? https://gist.github.com/ahcox/0e76d32a0a87ac24160bf50298052a1d

@sean-parent sean-parent mentioned this issue Aug 18, 2017
@sean-parent
Copy link
Member

sean-parent commented Aug 18, 2017

Apologies - when I tried it the code in the gist the failing portions were commented out - didn't realize I had to uncomment them to see the failure. I just added a PR #81 which I believe addresses the problem. This one was challenging!

@ahcox
Copy link
Author

ahcox commented Aug 18, 2017

My apologies about the original repro. I was running out the door to meet someone waiting for a training session in the park and rushed to get this to you. Your PR compiles for me here. The template stuff does look hairy. Thank you so much :-).

@fosterbrereton fosterbrereton added this to the 1.1 milestone Aug 19, 2017
@fosterbrereton
Copy link
Member

This issue has been fixed in master as of the 1.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants