]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/14616 (disjoint_set_test.cpp from boost does not compile (sizeof))
authorMark Mitchell <mark@codesourcery.com>
Sun, 21 Mar 2004 17:48:39 +0000 (17:48 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 21 Mar 2004 17:48:39 +0000 (17:48 +0000)
PR c++/14616
* decl.c (cp_finish_decl): Compute the size of arrays declared in
templates, if their type is non-dependent.

PR c++/14616
* g++.dg/init/array13.C: New test.

From-SVN: r79788

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/array13.C [new file with mode: 0644]

index 654e6a37a869a8eae7235d6d27ee66edddd577f1..8f5130663f3eadff6902113b97be04b862898bc0 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/14616
+       * decl.c (cp_finish_decl): Compute the size of arrays declared in
+       templates, if their type is non-dependent.
+
 2004-03-19  Mark Mitchell  <mark@codesourcery.com>
 
        * call.c (build_op_delete_call): Do not forget the placement
index b8a578f9ee0fbb1745e884c52ef3a4d9c9df9044..0b802ff7578f6eb9678d9788e16511623cf4d6b0 100644 (file)
@@ -4711,6 +4711,10 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags)
 
       if (init && DECL_INITIAL (decl))
        DECL_INITIAL (decl) = init;
+      if (TREE_CODE (decl) == VAR_DECL
+         && !DECL_PRETTY_FUNCTION_P (decl)
+         && !dependent_type_p (TREE_TYPE (decl)))
+       maybe_deduce_size_from_array_init (decl, init);
       goto finish_end0;
     }
 
index b53e941f16277a9c10860f112eb736a8dbeb4c7a..2ec9fe62044c0f7a4adf3d0b168f33aedeca91a5 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-21  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/14616
+       * g++.dg/init/array13.C: New test.
+
 2004-03-20  Roger Sayle  <roger@eyesopen.com>
 
        PR target/13889
diff --git a/gcc/testsuite/g++.dg/init/array13.C b/gcc/testsuite/g++.dg/init/array13.C
new file mode 100644 (file)
index 0000000..aa66e33
--- /dev/null
@@ -0,0 +1,9 @@
+template <typename DisjointSet> 
+struct test_disjoint_set { 
+  static void do_test() 
+  { 
+    unsigned int elts[] 
+        = { 0, 1, 2, 3 }; 
+    const int N = sizeof(elts)/sizeof(*elts); 
+  } 
+}; 
This page took 0.121666 seconds and 5 git commands to generate.