aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2016-05-24 20:29:36 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2016-05-24 14:29:36 -0600
commitf65e97fd3dc83bdbe6a1415f9527e68c35b841b3 (patch)
tree3d9ac91feb80adf20ab2902d32b9bdfb0ca76ed2 /gcc/tree.h
parent8e0dc0549a9d11fbf580db3ac45b49b5479dff13 (diff)
downloadgcc-f65e97fd3dc83bdbe6a1415f9527e68c35b841b3.zip
gcc-f65e97fd3dc83bdbe6a1415f9527e68c35b841b3.tar.gz
gcc-f65e97fd3dc83bdbe6a1415f9527e68c35b841b3.tar.bz2
PR c++/71147 - [6 Regression] Flexible array member wrongly rejected in template
gcc/ChangeLog: 2016-05-24 Martin Sebor <msebor@redhat.com> PR c++/71147 * gcc/tree.h (complete_or_array_type_p): New inline function. gcc/testsuite/ChangeLog: 2016-05-24 Martin Sebor <msebor@redhat.com> PR c++/71147 * g++.dg/ext/flexary16.C: New test. gcc/cp/ChangeLog: 2016-05-24 Martin Sebor <msebor@redhat.com> PR c++/71147 * decl.c (layout_var_decl, grokdeclarator): Use complete_or_array_type_p. * pt.c (instantiate_class_template_1): Try to complete the element type of a flexible array member. (can_complete_type_without_circularity): Handle arrays of unknown bound. * typeck.c (complete_type): Also complete the type of the elements of arrays with an unspecified bound. From-SVN: r236664
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index 2510d16..90413fc 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4753,6 +4753,17 @@ ptrofftype_p (tree type)
&& TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
}
+/* Return true if the argument is a complete type or an array
+ of unknown bound (whose type is incomplete but) whose elements
+ have complete type. */
+static inline bool
+complete_or_array_type_p (const_tree type)
+{
+ return COMPLETE_TYPE_P (type)
+ || (TREE_CODE (type) == ARRAY_TYPE
+ && COMPLETE_TYPE_P (TREE_TYPE (type)));
+}
+
extern tree strip_float_extensions (tree);
extern int really_constant_p (const_tree);
extern bool decl_address_invariant_p (const_tree);