-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Using Continuable 4.1.0
Reproduction steps:
- Launch Visual Studio 2019 native tools command prompt
- Create folder somewhere and switch to it
mkdir C:\temp\bug55 cd /d C:\temp\bug55 - Change to folder and clone Continuable
git clone --recursive https://github.com/naios/continuable - Create test.cpp with the following contents (e.g., via
copy con test.cpp)#include <continuable/continuable.hpp> static void Test() { int result = 0; cti::make_continuable<int>([result](auto&& promise) {}); } - Compile
cl /I .\continuable\include test.cpp /I .\continuable\dep\function2\function2\include
Note probably-unexpected error...
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30146 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include\ppltasks.h(1571): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
.\continuable\include\continuable/detail/core/base.hpp(143): error C2327: 'Test::<lambda_ce49853aebba6891891f5a54e1664ea4>::result': is not a type name, static, or enumerator
.\continuable\include\continuable/detail/core/base.hpp(168): note: see reference to class template instantiation 'cti::detail::base::proxy_continuable<hint_t,Test::<lambda_ce49853aebba6891891f5a54e1664ea4>>' being compiled
.\continuable\include\continuable/continuable-base.hpp(898): note: see reference to function template instantiation 'auto cti::detail::base::attorney::create_from<_Ty,cti::detail::identity<int>>(T &&,Hint,cti::detail::util::ownership)' being compiled
with
[
_Ty=Test::<lambda_ce49853aebba6891891f5a54e1664ea4>,
T=Test::<lambda_ce49853aebba6891891f5a54e1664ea4>,
Hint=cti::detail::identity<int>
]
test.cpp(4): note: see reference to function template instantiation 'auto cti::make_continuable<int,Test::<lambda_ce49853aebba6891891f5a54e1664ea4>>(Continuation &&)' being compiled
with
[
Continuation=Test::<lambda_ce49853aebba6891891f5a54e1664ea4>
]
In the end I tracked this down to captured variables in msvc apparently giving their lambda's type member variables of the same name. So result is a member variable on the base class for proxy_continuable in this case.
This feels like a msvc problem - looks like clang and gcc must rename the captured variables, or use some other mechanism? - but perhaps it's fixable. I'm afraid I stopped at C++14 so I have no specific suggestions. Maybe a note in the documentation would suffice.
Compiler Explorer example that I think narrows it down to the issue: https://godbolt.org/z/7qz4sd7sT
Thanks,
--Tom
Metadata
Metadata
Assignees
Labels
No labels