[LLVMbugs] [Bug 8107] New: __has_nothrow_copy not working for some types

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 7 15:06:58 PDT 2010


           Summary: __has_nothrow_copy not working for some types
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Here is a test that would be nice if it passed:

template <class T, bool Result>
    static_assert(__has_nothrow_copy(T) == Result, "");

class NotEmpty
    virtual ~NotEmpty();

int main()
    test__has_nothrow_copy<void, false>();
    test__has_nothrow_copy<int[3], false>();
    test__has_nothrow_copy<int[], false>();
    test__has_nothrow_copy<NotEmpty, true>();

The __has_nothrow_copy trait fails to compile for void types, and arrays of
unknown bounds.  I believe it should compile and return false for those.  I
also believe it should return false for arrays of known bounds because one can
not copy construct an array (even one of known bounds).  I plan to open an LWG
issue against N3126 on this last point.

Finally, though it is a QOI issue, I believe clang should be able to detect
that the NotEmpty example above has a non-trivial but nothrow copy constructor.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list