https://bugs.llvm.org/show_bug.cgi?id=45589

            Bug ID: 45589
           Summary: Short-circuiting in a requires-clause stops working if
                    any overload of `&&`/`||` is visible
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangb...@nondot.org
          Reporter: blck...@inbox.ru
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

Short-circuiting in a requires-clause normally works, but if any overload of
`&&`/`||` is visible, the corresponding operator stops short-circuiting.

Example for `||`:

struct Dummy {};
// Uncommenting this breaks the code:
// bool operator||(Dummy, Dummy) {return true;}

template <typename T>
struct A
{
    static constexpr bool value = T::value;
};

template <typename T>
void foo() requires (sizeof(T) == 1) || A<T>::value {}

int main()
{
    foo<char>();
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to