re PR c++/9749 (ICE in write_expression on invalid function prototype)

PR c++/9749
	* decl.c (grokdeclarator): Do not allow parameters with variably
	modified types.

	PR c++/9749
	* g++.dg/parse/varmod1.C: New test.

From-SVN: r63250
This commit is contained in:
Mark Mitchell 2003-02-21 22:56:06 +00:00 committed by Mark Mitchell
parent 9809a3624d
commit 2fff6d712a
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2003-02-21 Mark Mitchell <mark@codesourcery.com>
PR c++/9749
* decl.c (grokdeclarator): Do not allow parameters with variably
modified types.
2003-02-21 Nathan Sidwell <nathan@codesourcery.com>
* search.c (bfs_walk_grow): Remove. Fold into ...

View File

@ -11085,11 +11085,14 @@ grokdeclarator (tree declarator,
type = error_mark_node;
}
if (decl_context == FIELD
if ((decl_context == FIELD || decl_context == PARM)
&& !processing_template_decl
&& variably_modified_type_p (type))
{
error ("data member may not have variably modified type `%T'", type);
if (decl_context == FIELD)
error ("data member may not have variably modified type `%T'", type);
else
error ("parameter may not have variably modified type `%T'", type);
type = error_mark_node;
}

View File

@ -1,3 +1,8 @@
2003-02-21 Mark Mitchell <mark@codesourcery.com>
PR c++/9749
* g++.dg/parse/varmod1.C: New test.
2003-02-21 Mark Mitchell <mark@codesourcery.com>
PR c++/9727

View File

@ -0,0 +1,7 @@
int main(int argc, char** argv) {
int nx = 2;
void theerror(double a[][nx+1]); // { dg-error "" }
double** a;
theerror(a); // { dg-error "" }
return 0;
}