Commit f19218e5 by Mark Mitchell Committed by Mark Mitchell

re PR c++/29318 (ICE: type_info of pointer to VLA)

	PR c++/29318
	* 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.

From-SVN: r117683
parent fc6fabdf
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> 2006-10-12 Lee Millward <lee.millward@codesourcery.com>
PR c++/27961 PR c++/27961
......
...@@ -342,11 +342,10 @@ get_tinfo_decl (tree type) ...@@ -342,11 +342,10 @@ get_tinfo_decl (tree type)
tree name; tree name;
tree d; tree d;
if (COMPLETE_TYPE_P (type) if (variably_modified_type_p (type, /*fn=*/NULL_TREE))
&& TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
{ {
error ("cannot create type information for type %qT because " error ("cannot create type information for type %qT because "
"its size is variable", "it involves types of variable size",
type); type);
return error_mark_node; 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> 2006-10-12 Lee Millward <lee.millward@codesourcery.com>
PR c++/27961 PR c++/27961
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment