[llvm-bugs] [Bug 46269] New: Only first destructor is considered when constraints are used

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 10 11:31:06 PDT 2020


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

            Bug ID: 46269
           Summary: Only first destructor is considered when constraints
                    are used
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kacper.slominski72 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

When there are multiple destructors constrained with a requires clause, only
the first one is considered, like in the following code:

template <bool B>
struct A {
    ~A() requires (B) { }
    ~A() requires (!B) { }
};

A<false> x;

The compiler reports the following error:

<source>:7:10: error: invalid reference to function '~A': constraints not
satisfied
A<false> x;
         ^
<source>:3:20: note: because 'false' evaluated to false
    ~A() requires (B) { }
                   ^

The compiler prematurely reports an error about an invalid reference to the
destructor because the constraint on the first variant was not satisfied,
without checking the second variant.

The same code compiles with GCC without any problems.

-- 
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/20200610/6c4d4567/attachment-0001.html>


More information about the llvm-bugs mailing list