Summary: | __has_trivial_{copy/assign} behavior differs from documentation | ||
---|---|---|---|
Product: | gcc | Reporter: | Kenton Varda <temporal> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | daniel.kruegler, emsr, jason, richard-gccbugzilla, webrown.cpp |
Priority: | P3 | Keywords: | documentation |
Version: | 4.8.1 | ||
Target Milestone: | 12.0 | ||
See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85270 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98936 |
||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Kenton Varda
2013-12-09 08:46:15 UTC
The documentation definitely needs updating. The builtins track the C++11 semantics. Which C++11 semantics? Is __has_trivial_copy(T) intended to determine: 1) if T has a trivial copy constructor, or 2) whether T has a trivial copy constructor and no non-trivial copy constructor, or 3) whether the constructor selected to perform a copy from a 'const T' lvalue would be trivial, or 4) the value of std::is_trivially_copyable<T>::value? Sorry, I spent too little time on my message. I meant to say that, *in general*, our intrinsics (modulo bugs, of course) try to track the c++11 semantics of the corresponding C++11 type trait with the same name. In general - maybe that's already clear, I don't know - we don't try to provide a separate C++98 semantics when -std=c++98 is in effect. In the specific area at issue, the various is_trivially_* would be the reference, but those are still unimplemented. In my opinion we should simply deprecate the various __has_trivial*, which by now are just legacy, too bad that internally they are implemented in terms of functions which in turn changed over time, but frankly I'm not sure there is much interest in "fixing" that, implementing correctly the various is_trivially_* has a much higher priority. You may want to ask other people, of course. The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:83a21c993449a32b98916814ed8ca237b3276912 commit r12-7863-g83a21c993449a32b98916814ed8ca237b3276912 Author: Jason Merrill <jason@redhat.com> Date: Mon Mar 28 15:32:30 2022 -0400 c++: Fix __has_trivial_* docs [PR59426] These have been misdocumented since C++98 POD was split into C++11 trivial and standard-layout in r149721. PR c++/59426 gcc/ChangeLog: * doc/extend.texi: Refer to __is_trivial instead of __is_pod. Fixed. |