[llvm-bugs] [Bug 47748] New: [concepts] clang selects wrong destructor

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 6 14:08:12 PDT 2020


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

            Bug ID: 47748
           Summary: [concepts] clang selects wrong destructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ldalessandro 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

I believe that clang should ignore the problematic destructor in this template.

```
#include <type_traits>

struct Foo {
    ~Foo() {}
};

template <typename T>
struct Bar {
    ~Bar() requires( std::is_trivially_destructible_v<T>) = default;
    ~Bar() requires(!std::is_trivially_destructible_v<T>) {}
};

Bar<Foo> bar; // <-- picks `= default` and fails
```

Working example at https://godbolt.org/z/q5Phd1. Clang _does_ do this properly
on the default constructor side of things.

-- 
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/20201006/17e169db/attachment-0001.html>


More information about the llvm-bugs mailing list