diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-02-21 20:23:09 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-02-21 20:23:09 +0000 |
commit | 8b744dc90f2e24514652adcea73dee83d4aefb84 (patch) | |
tree | 4590cdaaddcae61143a8e8bc8a1ea54029fdb264 /gcc/cp/init.c | |
parent | 94faef692354e9dfb483866420a5f3d2883ef621 (diff) | |
download | gcc-8b744dc90f2e24514652adcea73dee83d4aefb84.tar.gz |
PR c++/79535
* cp-tree.h (maybe_reject_flexarray_init): Declare.
* init.c (maybe_reject_flexarray_init): No longer static.
Add check for current_function_decl.
* parser.c (cp_parser_late_parse_one_default_arg): Reject
a default mem-initializer for a flexible array.
* g++.dg/ext/flexary23.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245641 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index fa742268dc0..13ade8a616b 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -600,7 +600,7 @@ get_nsdmi (tree member, bool in_ctor) /* Diagnose the flexible array MEMBER if its INITializer is non-null and return true if so. Otherwise return false. */ -static bool +bool maybe_reject_flexarray_init (tree member, tree init) { tree type = TREE_TYPE (member); @@ -615,6 +615,7 @@ maybe_reject_flexarray_init (tree member, tree init) initializer list. */ location_t loc; if (DECL_INITIAL (member) == init + || !current_function_decl || DECL_DEFAULTED_FN (current_function_decl)) loc = DECL_SOURCE_LOCATION (member); else |