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

[clang] [c++20] build failure with libstdc++'s ranges code #59501

Closed
h-2 opened this issue Dec 13, 2022 · 3 comments
Closed

[clang] [c++20] build failure with libstdc++'s ranges code #59501

h-2 opened this issue Dec 13, 2022 · 3 comments
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" libstdc++ GNU libstdc++ C++ standard library

Comments

@h-2
Copy link
Member

h-2 commented Dec 13, 2022

#include <ranges>
#include <string_view>
#include <string>
#include <vector>

int main()
{
    auto s = std::vector<std::string>{};
    auto v = s | std::views::transform([] (std::string & s2) { return std::string_view{s2}; })
               | std::views::join;
    auto b = std::ranges::begin(v);      
}

godbolt

This builds with llvm-trunk&libc++, and it builds with gcc12&libstdc++, but it fails to build with llvm-trunk&libstdc++.

@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" libstdc++ GNU libstdc++ C++ standard library and removed new issue labels Dec 13, 2022
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2022

@llvm/issue-subscribers-clang-frontend

@royjacobson
Copy link
Contributor

The error is

error: no viable constructor or deduction guide for deduction of template arguments of '_Optional_func'
            this->_M_payload._M_apply(_Optional_func{__f}, __i);

This is the definition of _Optional_func:

template<typename _Fn> struct _Optional_func { _Fn& _M_f; };

So to me this looks like a case of missing CTAD for aggregates: #54051

@yuanfang-chen
Copy link
Collaborator

Fixed with https://reviews.llvm.org/D139837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" libstdc++ GNU libstdc++ C++ standard library
Projects
Status: Done
Development

No branches or pull requests

6 participants