[llvm-bugs] [Bug 33716] New: differences with Microsoft __has_nothrow_assign and __has_trivial_assign when the assign operator is deleted

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 7 13:28:54 PDT 2017


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

            Bug ID: 33716
           Summary: differences with Microsoft __has_nothrow_assign and
                    __has_trivial_assign when the assign operator is
                    deleted
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mib.bugzilla at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The Microsoft compiler will compile these without error, but clang gives static
assertions.

Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64

test.cpp
test.cpp:5:1: error: static_assert failed "__has_nothrow_assign is incorrect"
static_assert(!__has_nothrow_assign(non_assignable),
^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:7:1: error: static_assert failed "Fail"
static_assert(!__has_trivial_assign(non_assignable), "Fail");
^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
compilation aborted for test.cpp (code 1)
ksh-3.2$ cat test.cpp
struct non_assignable {
   non_assignable();
   non_assignable& operator=(const non_assignable&) = delete;
};
static_assert(!__has_nothrow_assign(non_assignable),
         "__has_nothrow_assign is incorrect");
static_assert(!__has_trivial_assign(non_assignable), "Fail");

-- 
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/20170707/d5a76a45/attachment.html>


More information about the llvm-bugs mailing list