[Bug c++/14616] New: disjoint_set_test.cpp from boost does not compile (sizeof)

schmid at snake dot iap dot physik dot tu-darmstadt dot de gcc-bugzilla@gcc.gnu.org
Wed Mar 17 08:52:00 GMT 2004


The appended file t.C, a reduced version of the file boost/libs/disjoint_sets/
disjoint_set_test.cpp, does not compile. Gcc 3.4.0 built on 2004-03-05 or the 
day before accepted the original code. I am wondering whether it is legal. If I 
define elts as elts[4] the code compiles. When I make do_test a free function 
the code is also accepted.  
 
template <typename DisjointSet> 
struct test_disjoint_set { 
  static void do_test() 
  { 
#if 1  
    unsigned int elts[] 
#else 
    unsigned int  elts[4] 
#endif  
        = { 0, 1, 2, 3 }; 
    const int N = sizeof(elts)/sizeof(*elts); 
  } 
}; 
 
 
    "g++"   -v -c -Wall -W "/home/peter/gnu/test/boost/libs/disjoint_sets/t.C"  
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs 
Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c
++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug 
Thread model: posix 
gcc version 3.4.0 20040313 (prerelease) 
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -quiet -v 
-D_GNU_SOURCE /home/peter/gnu/test/boost/libs/disjoint_sets/t.C -quiet 
-dumpbase t.C -mtune=pentiumpro -auxbase t -Wall -W -version -o /tmp/ccbUIG2T.s 
ignoring nonexistent directory "NONE/include" 
ignoring nonexistent directory "/usr/local/lib/gcc/
i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include" 
#include "..." search starts here: 
#include <...> search starts here: 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/
i686-pc-linux-gnu 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/
backward 
 /usr/local/include 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include 
 /usr/include 
End of search list. 
GNU C++ version 3.4.0 20040313 (prerelease) (i686-pc-linux-gnu) 
	compiled by GNU C version 3.4.0 20040313 (prerelease). 
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64274 
/home/peter/gnu/test/boost/libs/disjoint_sets/t.C: In static member function 
`static void test_disjoint_set<DisjointSet>::do_test()': 
/home/peter/gnu/test/boost/libs/disjoint_sets/t.C:11: error: invalid 
application of `sizeof' to an incomplete type

-- 
           Summary: disjoint_set_test.cpp from boost does not compile
                    (sizeof)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schmid at snake dot iap dot physik dot tu-darmstadt dot
                    de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 686-pc-linux-gnu
  GCC host triplet: 686-pc-linux-gnu
GCC target triplet: 686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list