[llvm-bugs] [Bug 51904] New: requires{ member_fn; } within a member function is true, despite member_fn; being an error

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 18 08:10:14 PDT 2021


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

            Bug ID: 51904
           Summary: requires{ member_fn; } within a member function is
                    true, despite member_fn; being an error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nyanpasu64 at tuta.io
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 25271
  --> https://bugs.llvm.org/attachment.cgi?id=25271&action=edit
Test case for requires{} expressions

If I define a class with a `void member_fn()` which contains `requires{
member_fn; }`, it evaluates to true on Clang but is an error on GCC, despite
`member_fn;` being an error on both compilers.

If I define a `template<typename T> Class : T` instantiated with a `T`
containing `base_fn()`, and `Class` contains a member function with `requires{
T::base_fn; }`, it evaluates to true on Clang but false on GCC, despite
`base_fn;` being an error on both compilers.

Is this a Clang bug, or is my code ill-formed? I was using the value of
`requires{}` as an input to `if constexpr` or `static_assert`, rather than as a
concept or template bound; is this allowed?

I've attached a file testing whether `requires{}` in various positions is true,
false, or an error to evaluate.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210918/3dc7b2ad/attachment-0001.html>


More information about the llvm-bugs mailing list