Re: [C++ Patch] PR 43453

2014-06-06 Thread Jason Merrill
I wondered if moving the list-collapsing code up for all cases would work, so I gave it a try and it seems to work fine. Tested x86_64-pc-linux-gnu, applying to trunk. commit 7d4d6e5d91d5677be05ad196a140f28b01a8f55f Author: Jason Merrill Date: Thu Jun 5 13:32:14 2014 -0400 PR c++/43453

Re: [C++ Patch] PR 43453

2014-06-04 Thread Jason Merrill
On 06/04/2014 04:17 PM, Paolo Carlini wrote: - if (TREE_CODE (init) == TREE_LIST - && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) - { - error ("cannot initialize arrays using this syntax"); - return NULL_TREE; - } - else - /* We get here wi

Re: [C++ Patch] PR 43453

2014-06-04 Thread Paolo Carlini
... sorry attached a wrong diff. Paolo. / Index: cp/decl.c === --- cp/decl.c (revision 211242) +++ cp/decl.c (working copy) @@ -5758,6 +5758,13 @@ check_initializer (tree decl, tree init, int flags

Re: [C++ Patch] PR 43453

2014-06-04 Thread Paolo Carlini
Hi, On 06/04/2014 09:32 PM, Jason Merrill wrote: On 06/04/2014 02:08 PM, Paolo Carlini wrote: /* An array of character type can be initialized from a - brace-enclosed string constant. - - FIXME: this code is duplicated from reshape_init. Probably - we should just call reshap

Re: [C++ Patch] PR 43453

2014-06-04 Thread Jason Merrill
On 06/04/2014 02:08 PM, Paolo Carlini wrote: /* An array of character type can be initialized from a -brace-enclosed string constant. - -FIXME: this code is duplicated from reshape_init. Probably -we should just call reshape_init here? */ It strikes me as odd th

Re: [C++ Patch] PR 43453

2014-06-04 Thread Paolo Carlini
Hi, On 06/04/2014 04:16 PM, Jason Merrill wrote: if (TREE_CODE (init) == TREE_LIST - && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) + && TREE_CODE (type) == ARRAY_TYPE + /* C++11 8.5/17: "If the destination type is an array of characters, + an array of char16_t, an

Re: [C++ Patch] PR 43453

2014-06-04 Thread Jason Merrill
On 05/26/2014 11:41 AM, Paolo Carlini wrote: + /* C++11 8.5/17: "If the destination type is an array of characters, +an array of char16_t, an array of char32_t, or an array of wchar_t, +and the initializer is a string literal...". */ + else if (TREE_CODE (newrhs) == STR

Re: [C++ Patch] PR 43453

2014-06-04 Thread Paolo Carlini
Hi, On 05/26/2014 05:41 PM, Paolo Carlini wrote: ... the below should be better, handles correctly cv-qualifiers. Pinging this... Thanks! Paolo.

Re: [C++ Patch] PR 43453

2014-05-26 Thread Paolo Carlini
... the below should be better, handles correctly cv-qualifiers. Thanks, Paolo. Index: cp/typeck.c === --- cp/typeck.c (revision 210928) +++ cp/typeck.c (working copy) @@ -7502,6 +7502,18 @@ cp_build_modify_expr

[C++ Patch] PR 43453

2014-05-26 Thread Paolo Carlini
Hi, according to the analysis, we should not reject these initializations. Thus I added some code following closely 8.5/17. I also enlarged the testcase a bit to make sure that, for example, we still reject too long initializer-strings (a preliminary draft didn't call digest_init) Tested x86