Title says it all really, code like:

#include <tr1/type_traits>

struct foo;

static const bool b = std::tr1::is_object<foo>::value;

doesn't compile, when it should: although many of the type_traits have a
precondition that they need not work with incomplete types, this isn't one of
those traits.

Oh and the error message was:

/usr/local/gcc/4.0.2/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../include/c++/4.0.2/tr1/type_traits:
In instantiation of `const bool std::tr1::__conv_helper<incomplete_type&,
incomplete_type*>::__value':
/usr/local/gcc/4.0.2/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../include/c++/4.0.2/tr1/type_traits:192:
  instantiated from `const bool std::tr1::__is_function_helper<incomplete_type,
false>::__value'
/usr/local/gcc/4.0.2/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../include/c++/4.0.2/tr1/type_traits:202:
  instantiated from `std::tr1::is_function<incomplete_type>'
/usr/local/gcc/4.0.2/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../include/c++/4.0.2/tr1/type_traits:222:
  instantiated from `std::tr1::is_object<incomplete_type>'
/home/john/boost/libs/type_traits/test/is_object_test.cpp:24:   instantiated
from here
/usr/local/gcc/4.0.2/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../include/c++/4.0.2/tr1/type_traits:62:
error: invalid use of undefined type `struct incomplete_type'
/home/john/boost/libs/type_traits/test/test.hpp:349: error: forward declaration
of `struct incomplete_type'

Regards, John Maddock.


-- 
           Summary: is_object fails to compile with incomplete types
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john at johnmaddock dot co dot uk
 GCC build triplet: linux.x86
  GCC host triplet: linux.x86
GCC target triplet: linux.x86


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24808

Reply via email to