summaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 19:51:52 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 19:51:52 +0000
commit604275966c6d718b11a295091c366f7e98974e48 (patch)
treecf1aa9cecbf228591a7c53d99bdc51da8621d751 /gcc/cp/decl2.c
parentcae2795e59012d95eb509587a7c44d8586a4b71f (diff)
downloadgcc-604275966c6d718b11a295091c366f7e98974e48.tar.gz
PR c++/52748
* parser.c (complain_flags): New. (cp_parser_postfix_expression): Use it. (cp_parser_unary_expression): Likewise. (cp_parser_binary_expression): Likewise. (cp_parser_assignment_expression): Likewise. (cp_parser_expression): Likewise. (cp_parser_postfix_open_square_expression): Take decltype_p. (cp_parser_builtin_offsetof): Adjust. (cp_convert_range_for): Pass complain to finish_unary_op_expr. * semantics.c (finish_unary_op_expr): Add complain parm. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197826 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 407b46159d2..a5b265502f7 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -335,10 +335,11 @@ grokclassfn (tree ctype, tree function, enum overload_flags flags)
}
/* Create an ARRAY_REF, checking for the user doing things backwards
- along the way. */
+ along the way. DECLTYPE_P is for N3276, as in the parser. */
tree
-grok_array_decl (location_t loc, tree array_expr, tree index_exp)
+grok_array_decl (location_t loc, tree array_expr, tree index_exp,
+ bool decltype_p)
{
tree type;
tree expr;
@@ -364,8 +365,13 @@ grok_array_decl (location_t loc, tree array_expr, tree index_exp)
/* If they have an `operator[]', use that. */
if (MAYBE_CLASS_TYPE_P (type) || MAYBE_CLASS_TYPE_P (TREE_TYPE (index_exp)))
- expr = build_new_op (loc, ARRAY_REF, LOOKUP_NORMAL, array_expr, index_exp,
- NULL_TREE, /*overload=*/NULL, tf_warning_or_error);
+ {
+ tsubst_flags_t complain = tf_warning_or_error;
+ if (decltype_p)
+ complain |= tf_decltype;
+ expr = build_new_op (loc, ARRAY_REF, LOOKUP_NORMAL, array_expr,
+ index_exp, NULL_TREE, /*overload=*/NULL, complain);
+ }
else
{
tree p1, p2, i1, i2;