http://llvm.org/bugs/show_bug.cgi?id=21010
Bug ID: 21010
Summary: incorrect result for is_trivially_copyable on class
with deleted destructor
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
The following example results in is_trivially_copyable being true while it
should be false:
#include <iostream>
#include <type_traits>
struct foo {
int bar;
~foo() = delete;
};
int main() {
std::cout << std::is_trivially_copyable<foo>::value << std::endl;
return 0;
}
The problem is that clang checks if the class has no non-trivial destructors,
instead of checking if it has a trivial destructor, an important distinction.
Consider how trivially copyable is defined in the draft standard:
A trivially copyable class is a class that:
— has no non-trivial copy constructors (12.8),
— has no non-trivial move constructors (12.8),
— has no non-trivial copy assignment operators (13.5.3, 12.8),
— has no non-trivial move assignment operators (13.5.3, 12.8), and
— has a trivial destructor (12.4).
Note the last bullet point. So clearly 'foo' should not be trivially copyable,
because it has no trivial destructor, since it was deleted.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs