Skip to content

Return types of logical_and and logical_or don't match ISO C++ #646

@Pennycook

Description

@Pennycook

SYCL defines these function objects as:

template <typename T = void> struct logical_and {
  T operator()(const T& x, const T& y) const;
};

template <typename T = void> struct logical_or {
  T operator()(const T& x, const T& y) const;
};

Whereas ISO C++ defines them both as returning bool. bool makes a lot more sense to me than T, because the operators are defined as returning x && y and x || y.

I suspect this is a bug that arose from copying and pasting other function object definitions, but before writing up the fix I wanted to check whether anybody knew of a reason that things should be defined this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AgendaTo be discussed during a SYCL committee meetingbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions