Skip to content

<ranges>: could not use std::views::istream #13

@xiaosa-zhz

Description

@xiaosa-zhz

Basic Info

  • I have read the rules for the Standard Library Modules Bug Bash.

  • I have pulled and rebuilt the bug-bash branch in the last 24 hours.

  • My current commit, as printed by git rev-parse HEAD, is: 6ddfaf5

  • This bug is:
    rejects-valid

Command-Line Test Case

My test case that works with classic includes but fails with named modules:

c:\STL\STL>type helloworld.cpp
#ifdef USE_CLASSIC_INCLUDES
#include <ranges>
#include <iostream>
#include <algorithm>
#else
import std;
#endif // USE_CLASSIC_INCLUDES

namespace stdr = std::ranges;
namespace stdv = std::views;

int main()
{
    auto input = stdv::istream<int>(std::cin)
        | stdv::take_while([](auto e) { return e != 0; });
    stdr::for_each(input, [](auto e) { std::cout << e << '\n'; });
}
c:\STL\STL>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od helloworld.cpp /DUSE_CLASSIC_INCLUDES && helloworld.exe
helloworld.cpp
1 2 3 0
1
2
3

c:\STL\STL>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od helloworld.cpp std.obj
helloworld.cpp
helloworld.obj : error LNK2019: 无法解析的外部符号 "struct _Istream_fn<int>::std::ranges::_Istream_fn<int> const std::ranges::views::istream<int>" (??$istream@H@views@ranges@std@@3U?$_Istream_fn@H@123@B::<!std>),函数 _main 中引用了该符号
helloworld.exe : fatal error LNK1120: 1 个无法解析的外部命令

Additional Context

Do I get the format right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions