Describe the bug
I tried porting the example on how to use std::generator from cppreference
and i get this error:
Severity Code Description Project File Line Suppression State Details
Error C2528 'abstract declarator': you cannot create a pointer to a reference test_generators C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\experimental\generator 109
Command-line test case
#include <experimental/generator>
#include <iostream>
template<typename T>
struct Tree
{
T value;
Tree* left{}, * right{};
std::experimental::generator<const T&> traverse_inorder() const
{
if (left)
for (const T& x : left->traverse_inorder())
co_yield x;
co_yield value;
if (right)
for (const T& x : right->traverse_inorder())
co_yield x;
}
};
int main()
{
Tree<char> tree[]
{
{'D', tree + 1, tree + 2},
// │
// ┌───────────────┴────────────────┐
// │ │
{'B', tree + 3, tree + 4}, {'F', tree + 5, tree + 6},
// │ │
// ┌─────────┴─────────────┐ ┌───────────┴─────────────┐
// │ │ │ │
{'A'}, {'C'}, {'E'}, {'G'}
};
for (char x : tree->traverse_inorder())
std::cout << x << ' ';
std::cout << '\n';
}
Expected behavior
Should work and print out A B C D E F G
STL version

Additional context
Just in case this is helpful:

Describe the bug
I tried porting the example on how to use std::generator from cppreference
and i get this error:
Command-line test case
Expected behavior
Should work and print out
A B C D E F GSTL version
Additional context
Just in case this is helpful:
