diff options
author | Jason Merrill <jason@redhat.com> | 2011-08-05 15:15:25 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-08-05 15:15:25 -0400 |
commit | d3de8016a5f79800aa5f04f8ef8faf7a4874c23c (patch) | |
tree | d1fa48e7dea3e1964b28499d0acaf10eb15e755c /gcc/cp | |
parent | 9127e99420ca8f238f15c06fe7f9089e38ed862d (diff) | |
download | gcc-d3de8016a5f79800aa5f04f8ef8faf7a4874c23c.zip gcc-d3de8016a5f79800aa5f04f8ef8faf7a4874c23c.tar.gz gcc-d3de8016a5f79800aa5f04f8ef8faf7a4874c23c.tar.bz2 |
re PR c++/47453 ([DR 1214] Various non-conforming behaviors with braced-init-list initialization)
PR c++/47453
* typeck.c (build_x_compound_expr_from_list): Also complain
about ({...}).
From-SVN: r177480
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 46eee7e..ea66fa1d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-08-05 Jason Merrill <jason@redhat.com> + PR c++/47453 + * typeck.c (build_x_compound_expr_from_list): Also complain + about ({...}). + PR c++/49812 * typeck.c (cp_build_unary_op) [POSTINCREMENT_EXPR]: Strip cv-quals. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f53deb9..a1f6761 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5470,6 +5470,16 @@ build_x_compound_expr_from_list (tree list, expr_list_kind exp, { tree expr = TREE_VALUE (list); + if (BRACE_ENCLOSED_INITIALIZER_P (expr) + && !CONSTRUCTOR_IS_DIRECT_INIT (expr)) + { + if (complain & tf_error) + pedwarn (EXPR_LOC_OR_HERE (expr), 0, "list-initializer for " + "non-class type must not be parenthesized"); + else + return error_mark_node; + } + if (TREE_CHAIN (list)) { if (complain & tf_error) |