diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-02-21 22:56:06 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-02-21 22:56:06 +0000 |
commit | 2fff6d712a2f60614485537316ec68a9cba4e249 (patch) | |
tree | 6b58d042074da45c56a409264d627829afcce86b /gcc | |
parent | 9809a3624d899076cd7b3f756941ffba81dee7d8 (diff) | |
download | gcc-2fff6d712a2f60614485537316ec68a9cba4e249.zip gcc-2fff6d712a2f60614485537316ec68a9cba4e249.tar.gz gcc-2fff6d712a2f60614485537316ec68a9cba4e249.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/varmod1.C | 7 |
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 960c36d..00be1dd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 ... diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3f22b74..caf3891 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ed4f626..b015a6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * g++.dg/template/op1.C: New test. diff --git a/gcc/testsuite/g++.dg/parse/varmod1.C b/gcc/testsuite/g++.dg/parse/varmod1.C new file mode 100644 index 0000000..bf64507 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/varmod1.C @@ -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; +} |