You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2008/07/03 00:12:44 UTC

[jira] Commented: (STDCXX-983) [Linux/gcc] 20.meta.unary.prop.cpp fails is_pod assertions

    [ https://issues.apache.org/jira/browse/STDCXX-983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610069#action_12610069 ] 

Travis Vitek commented on STDCXX-983:
-------------------------------------

This is the documentation for the helper (taken from [here|http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Type-Traits.html#Type-Traits])

 __is_pod (type){quote}If type is a cv POD type ([basic.types]) then the trait is true, else it is false. Requires: type shall be a complete type, an array of unknown bound or is a void type.{quote}

Here are the pertenent sections of the standard

3.9 p9{quote}Scalar types, POD classes (clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called POD types. Scalar types, trivial class types (clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called trivial types. Scalar types, standard-layout class types (clause 9), arrays of such types and cv-qualified versions of these types (3.9.3) are collectively called standard-layout types.{quote}

9 p5{quote}a trivial class is a class that
          -- has a trivial default constructor
          -- has a trivial copy constructor
          -- has a trivial copy assignment operator
          -- has a trivial destructor
{quote}

9 p6{quote}a standard-layout class is a class that
          -- has no non-static data members of type non-standard-layout class (or array of such types) or reference
          -- has no virtual functions and no virtual base classes
          -- has the same access control for all non-static data members
          -- has no non-standard-layout base classes
          -- either has no non-static data members in the most-derived class and at most one base class with non-static data members, or has no base classes with non-static data members
          -- has no base classes of the same type as the first non-static data member
{quote}

9 p9{quote}a POD struct is a class that is both a trivial class and a standard-layout class, and has no non-static data members of type non-POD struct, non-POD union (or array of such types). Similarly, a POD union is a union that is both a trivial class and a standard layout class, and has no non-static data members of type non-POD struct, non-POD union (or array of such types).A POD class is a class that is either a POD struct or a POD union.{quote}


> [Linux/gcc] 20.meta.unary.prop.cpp fails is_pod assertions
> ----------------------------------------------------------
>
>                 Key: STDCXX-983
>                 URL: https://issues.apache.org/jira/browse/STDCXX-983
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: TR1.4 - Metaprogramming and Type Traits
>    Affects Versions: 4.3
>         Environment: gcc-4.3
>            Reporter: Travis Vitek
>             Fix For: 4.3
>
>
> I'm pretty confident that the following should compile and run without failure. It abbends with SIGABRT with recent versions of gcc-4.3.
> {noformat}
> $ cat t.cpp && g++ t.cpp && ./a.out
> #include <assert.h>
> struct empty_t
> {
> };
> struct trivial_t
> {
>   long value;
> };
> template <class T>
> struct public_derived_t : T
> {
> };
> int main ()
> {
>     assert (__is_pod(trivial_t));
>     assert (__is_pod(public_derived_t<trivial_t>));
>     assert (__is_pod(empty_t));
>     assert (__is_pod(public_derived_t<empty_t>));
>     return 0;
> }
> a.out: t.cpp:20: int main(): Assertion `__is_pod(public_derived_t<trivial_t>)' failed.
> Aborted
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.