* rtti.c (get_tinfo_decl): Refuse to create type info objects for
variably modified types.
PR c++/29318
* g++.dg/ext/vla4.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117683
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-10-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/29318
+ * rtti.c (get_tinfo_decl): Refuse to create type info objects for
+ variably modified types.
+
2006-10-12 Lee Millward <lee.millward@codesourcery.com>
PR c++/27961
tree name;
tree d;
- if (COMPLETE_TYPE_P (type)
- && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
+ if (variably_modified_type_p (type, /*fn=*/NULL_TREE))
{
error ("cannot create type information for type %qT because "
- "its size is variable",
+ "it involves types of variable size",
type);
return error_mark_node;
}
+2006-10-12 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/29318
+ * g++.dg/ext/vla4.C: New test.
+
2006-10-12 Lee Millward <lee.millward@codesourcery.com>
PR c++/27961
--- /dev/null
+// PR c++/29318
+// { dg-options "" }
+
+#include <typeinfo>
+
+void f(int i) {
+ try {
+ int a[i];
+ throw &a; // { dg-error "variable size" }
+ } catch (int (&)[i]) { // { dg-error "variable size" }
+ }
+}
+
+int main()
+{
+ int i = 5;
+ int va[i];
+ const std::type_info& info(typeid(&va)); // { dg-error "variable size" }
+
+ return 0;
+}