You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30136 for x64" with "Conan version 1.43.4" on the package "andreasbuhr-cppcoro/cci.20210113".
#include <cppcoro/generator.hpp>
#include <ranges>
cppcoro::generator<int> generate() {
for (int i = 0; i < 10; ++i) {
co_yield i;
}
}
void WhereThingsAreOk() {
auto g = generate();
for (auto j :
g | std::views::transform([](int x) -> int { return x * 2; })) {
}
}
void WhereThingsGoWrong() {
for (auto j : generate() | std::views::transform(
[](int x) -> int { return x * 2; })) {
}
}
When I use a generator (or recursive generator same problem) that is an r-value in a foreach (like in "WhereThingsGoWrong") it only works when I compile in debug. But when I compile in Release I get the following error:
error C2678: binary '|': no operator found which takes a left-hand operand of type 'cppcoro::generator<int>' (or there is no acceptable conversion)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xfilesystem_abi.h(229): note: could be '__std_fs_copy_options operator |(__std_fs_copy_options,__std_fs_copy_options) noexcept'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xfilesystem_abi.h(204): note: or '__std_fs_file_flags operator |(__std_fs_file_flags,__std_fs_file_flags) noexcept'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xfilesystem_abi.h(196): note: or '__std_access_rights operator |(__std_access_rights,__std_access_rights) noexcept'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xfilesystem_abi.h(122): note: or '__std_fs_stats_flags operator |(__std_fs_stats_flags,__std_fs_stats_flags) noexcept'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xfilesystem_abi.h(79): note: or '__std_fs_file_attr operator |(__std_fs_file_attr,__std_fs_file_attr) noexcept'
blah.cpp(21): note: while trying to match the argument list '(cppcoro::generator<int>, std::ranges::views::_Transform_fn::_Partial<_Fn>)'
with
[
_Fn=WhereThingsGoWrong::<lambda_1>
]
blah.cpp(20): error C3531: 'j': a symbol whose type contains 'auto' must have an initializer
blah.cpp(20): error C2143: syntax error: missing ';' before ':'
blah.cpp(20): error C2088: '|': illegal for class
blah.cpp(21): error C2143: syntax error: missing ';' before ')'
Can someone explain what's going on here? It looks to me like the sfinae is different when compiling in release, is this on purpose? Am I missing something?
The text was updated successfully, but these errors were encountered:
I am using "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30136 for x64" with "Conan version 1.43.4" on the package "andreasbuhr-cppcoro/cci.20210113".
When I use a generator (or recursive generator same problem) that is an r-value in a foreach (like in "WhereThingsGoWrong") it only works when I compile in debug. But when I compile in Release I get the following error:
Can someone explain what's going on here? It looks to me like the sfinae is different when compiling in release, is this on purpose? Am I missing something?
The text was updated successfully, but these errors were encountered: