LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 47601 - Non-reserved names in pstl/execution_impl.h
Summary: Non-reserved names in pstl/execution_impl.h
Status: RESOLVED FIXED
Alias: None
Product: parallel STL
Classification: Unclassified
Component: New (show other bugs)
Version: unspecified
Hardware: All All
: P normal
Assignee: Louis Dionne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-21 09:04 PDT by Jonathan Wakely
Modified: 2021-03-03 08:38 PST (History)
1 user (show)

See Also:
Fixed By Commit(s): 053146a690774f8955893fbb995ae176eb2e00a7


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2020-09-21 09:04:24 PDT
The members of __internal::__policy_traits aren't using reserved names:

template <>
struct __policy_traits<sequenced_policy>
{
    typedef std::false_type allow_parallel;
    typedef std::false_type allow_unsequenced;
    typedef std::false_type allow_vector;
};

This means the alias templates following it are broken:

template <typename _ExecutionPolicy>
using __collector_t =
    typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__collector_type;


This is invalid, because __collector_type doesn't exist, the member is really called collector_type (although it shouldn't be).

And later in that file:

template <typename policy, typename... _IteratorTypes>
struct __prefer_unsequenced_tag

and

template <typename policy, typename... _IteratorTypes>
struct __prefer_parallel_tag

These use "policy" which is not a reserved name either.
Comment 1 Jonathan Wakely 2020-09-21 09:17:18 PDT
(In reply to Jonathan Wakely from comment #0)
> template <typename _ExecutionPolicy>
> using __collector_t =
>     typename __internal::__policy_traits<typename
> std::decay<_ExecutionPolicy>::type>::__collector_type;


N.B. collector_t alias appears to be completely unused, and no specialization of __policy_traits defines __collector_type. So ignore that one, but the same problem exists for:

template <typename _ExecutionPolicy>
using __allow_vector =
    typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_vector;

template <typename _ExecutionPolicy>
using __allow_unsequenced =
    typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_unsequenced;

template <typename _ExecutionPolicy>
using __allow_parallel =
    typename __internal::__policy_traits<typename std::decay<_ExecutionPolicy>::type>::__allow_parallel;

These also aren't used, and refer to non-existent members, but they *could* be used (if they were fixed), see Bug 47602.
Comment 2 Louis Dionne 2021-03-02 14:21:11 PST
Up for review in https://reviews.llvm.org/D97808
Comment 3 Louis Dionne 2021-03-03 08:38:00 PST
commit 053146a690774f8955893fbb995ae176eb2e00a7
Author: Louis Dionne <ldionne.2@gmail.com>
Date:   Tue Mar 2 16:53:07 2021 -0500

    [pstl] Fix broken policy_traits and clean up unused code

    https://llvm.org/PR47602
    https://llvm.org/PR47601

    Differential Revision: https://reviews.llvm.org/D97808