[llvm-bugs] [Bug 51016] New: constness mismatch on defaulted copy constructor / assignment incorrectly prevents triviality

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 7 13:00:47 PDT 2021


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

            Bug ID: 51016
           Summary: constness mismatch on defaulted copy constructor /
                    assignment incorrectly prevents triviality
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Testcase:

struct Q {
  Q(Q&) noexcept(false) = default;
  Q &operator=(Q&) & noexcept(false) = default;
};
static_assert(__is_trivially_copyable(Q), "");

The assertion here should pass: changing the ref-qualifier, exception
specification, or the constness of the parameter type should not affect the
triviality of a defaulted special member function.

Clang incorrectly treats the special member functions as being non-trivial here
because their parameter types don't have the expected constness.

-- 
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/20210707/e30c76a5/attachment.html>


More information about the llvm-bugs mailing list