From 02673c66c6477d1212a49a602f74c624267dda29 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 2 May 2016 08:28:33 +0000 Subject: [PATCH] decl.c (grokdeclarator): Properly insert a DECL_EXPR for anonymous VLAs. 2016-05-02 Richard Biener cp/ * decl.c (grokdeclarator): Properly insert a DECL_EXPR for anonymous VLAs. From-SVN: r235706 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 25af3f2603e..792c9c8e673 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-05-02 Richard Biener + + * decl.c (grokdeclarator): Properly insert a DECL_EXPR for + anonymous VLAs. + 2016-04-29 Paolo Carlini PR c++/66644 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a74e9a24a4e..5f9031f0664 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10393,8 +10393,11 @@ grokdeclarator (const cp_declarator *declarator, && (decl_context == NORMAL || decl_context == FIELD) && at_function_scope_p () && variably_modified_type_p (type, NULL_TREE)) - /* Force evaluation of the SAVE_EXPR. */ - finish_expr_stmt (TYPE_SIZE (type)); + { + TYPE_NAME (type) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, + NULL_TREE, type); + add_decl_expr (TYPE_NAME (type)); + } if (declarator->kind == cdk_reference) { -- 2.30.2