diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 16:43:43 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 16:43:43 +0000 |
commit | d680c844a90ba12a0b12f7d206d697dc32d2cfee (patch) | |
tree | c69b9ba944e0bd1c54e3eb3cab495fee009d3bf5 /gcc/cp/decl.c | |
parent | b749017fafed446f28d44b6fd3345a5fd39faaf1 (diff) | |
download | gcc-d680c844a90ba12a0b12f7d206d697dc32d2cfee.tar.gz |
N3639 C++1y VLA diagnostics
* decl.c (grokdeclarator): Complain about reference, pointer, or
typedef to VLA.
(create_array_type_for_decl): Complain about array of VLA.
* pt.c (tsubst): Likewise.
* rtti.c (get_tinfo_decl): Talk about "array of runtime bound".
* semantics.c (finish_decltype_type): Complain about decltype of VLA.
* typeck.c (cp_build_addr_expr_1): Complain about VLA.
(cxx_sizeof_or_alignof_type): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198746 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index cebd36103b7..438d27de1bd 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8479,6 +8479,9 @@ create_array_type_for_decl (tree name, tree type, tree size) return error_mark_node; } + if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)) + pedwarn (input_location, OPT_Wvla, "array of array of runtime bound"); + /* Figure out the index type for the array. */ if (size) itype = compute_array_index_type (name, size, tf_warning_or_error); @@ -9720,6 +9723,12 @@ grokdeclarator (const cp_declarator *declarator, : G_("cannot declare pointer to qualified function type %qT"), type); + if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)) + pedwarn (input_location, OPT_Wvla, + declarator->kind == cdk_reference + ? G_("reference to array of runtime bound") + : G_("pointer to array of runtime bound")); + /* When the pointed-to type involves components of variable size, care must be taken to ensure that the size evaluation code is emitted early enough to dominate all the possible later uses @@ -10074,6 +10083,10 @@ grokdeclarator (const cp_declarator *declarator, type = error_mark_node; } + if (cxx_dialect >= cxx1y && array_of_runtime_bound_p (type)) + pedwarn (input_location, OPT_Wvla, + "typedef naming array of runtime bound"); + if (decl_context == FIELD) decl = build_lang_decl (TYPE_DECL, unqualified_id, type); else |