Bug 100900 - error: missing 'typename' prior to dependent type name in <ranges> elements_view
Summary: error: missing 'typename' prior to dependent type name in <ranges> elements_view
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 10.4
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2021-06-04 06:54 UTC by Avi Kivity
Modified: 2021-07-06 19:46 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-06-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Avi Kivity 2021-06-04 06:54:38 UTC
clang++ complains:

/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/ranges:3392:19: error: missing 'typename' prior to dependent type name 'iterator_traits<iterator_t<_Base>>::iterator_category'
            using _Cat = iterator_traits<iterator_t<_Base>>::iterator_category;
Comment 1 康桓瑋 2021-06-04 07:48:20 UTC
(In reply to Avi Kivity from comment #0)
> clang++ complains:
> 
> /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/ranges:3392:
> 19: error: missing 'typename' prior to dependent type name
> 'iterator_traits<iterator_t<_Base>>::iterator_category'
>             using _Cat =
> iterator_traits<iterator_t<_Base>>::iterator_category;

Clang doesn't fully support the C++20 language features that libstdc++ uses in its implementation (Down with typename!).
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0634r3.html
Comment 2 Jonathan Wakely 2021-06-04 09:25:32 UTC
Yes, this is a gap in clang's C++20 implementation, so we should work around it in libstdc++.
Comment 3 Avi Kivity 2021-06-07 13:28:13 UTC
Note, I posted a patch for this to gcc-patches, to save you the effort of typing those 9 letters.
Comment 4 Patrick Palka 2021-06-07 13:35:05 UTC
(In reply to Avi Kivity from comment #3)
> Note, I posted a patch for this to gcc-patches, to save you the effort of
> typing those 9 letters.

Ah thanks, I missed that :)
Comment 5 GCC Commits 2021-06-07 15:20:27 UTC
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:5e2e15f212e2458a1258b8c856895c755460bc6b

commit r12-1262-g5e2e15f212e2458a1258b8c856895c755460bc6b
Author: Avi Kivity <avi@scylladb.com>
Date:   Mon Jun 7 11:19:05 2021 -0400

    libstdc++: add missing typename for dependent type in ranges::elements_view [PR100900]
    
    Clang complains about the missing typename. I believe it's not required
    in a more complete implementation of C++, but it's nicer to support
    less complete implementations.
    
            PR libstdc++/100900
    
    libstdc++-v3/ChangeLog:
    
            * include/std/ranges (elements_view::__iter_cat::_S_iter_cat):
            Add missing typename.
Comment 6 GCC Commits 2021-06-07 15:24:28 UTC
The releases/gcc-11 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:23fa1e7eab7680ae0488b4c8802b0bcd8f78425d

commit r11-8519-g23fa1e7eab7680ae0488b4c8802b0bcd8f78425d
Author: Avi Kivity <avi@scylladb.com>
Date:   Mon Jun 7 11:19:05 2021 -0400

    libstdc++: add missing typename for dependent type in ranges::elements_view [PR100900]
    
    Clang complains about the missing typename. I believe it's not required
    in a more complete implementation of C++, but it's nicer to support
    less complete implementations.
    
            PR libstdc++/100900
    
    libstdc++-v3/ChangeLog:
    
            * include/std/ranges (elements_view::__iter_cat::_S_iter_cat):
            Add missing typename.
    
    (cherry picked from commit 5e2e15f212e2458a1258b8c856895c755460bc6b)
Comment 7 Patrick Palka 2021-06-07 15:30:10 UTC
Patch pushed to trunk and the 11 branch, thanks!
Comment 8 Avi Kivity 2021-06-07 15:49:43 UTC
I see you added the changelog entry. I'll be sure to do that next time I post a patch.
Comment 9 Dmitry V. Levin 2021-07-05 00:57:16 UTC
Since PR95983 fix was backported to gcc-10 (by commit 1cb39945993c89746b0347746bd1267de85cbc42), please backport this follow-up fix to gcc-10, too.
Comment 10 GCC Commits 2021-07-06 19:36:16 UTC
The releases/gcc-10 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:e9fbf0f9d621213ea16713b595feb88b789a8858

commit r10-9969-ge9fbf0f9d621213ea16713b595feb88b789a8858
Author: Avi Kivity <avi@scylladb.com>
Date:   Mon Jun 7 11:19:05 2021 -0400

    libstdc++: add missing typename for dependent type in ranges::elements_view [PR100900]
    
    Clang complains about the missing typename. I believe it's not required
    in a more complete implementation of C++, but it's nicer to support
    less complete implementations.
    
            PR libstdc++/100900
    
    libstdc++-v3/ChangeLog:
    
            * include/std/ranges (elements_view::__iter_cat::_S_iter_cat):
            Add missing typename.
    
    (cherry picked from commit 5e2e15f212e2458a1258b8c856895c755460bc6b)
Comment 11 Patrick Palka 2021-07-06 19:46:03 UTC
(In reply to Dmitry V. Levin from comment #9)
> Since PR95983 fix was backported to gcc-10 (by commit
> 1cb39945993c89746b0347746bd1267de85cbc42), please backport this follow-up
> fix to gcc-10, too.

done