Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Jason Merrill
OK. Jason

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Paolo Carlini
Hi, On 03/26/2013 04:10 PM, Jason Merrill wrote: On 03/26/2013 11:00 AM, Paolo Carlini wrote: + tree ce_index = cxx_constant_value (ce->index); + + if (TREE_CODE (ce_index) == INTEGER_CST) +{ /* A C99 designator is OK if it matches the current index. */ - if (TREE_IN

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Jason Merrill
On 03/26/2013 11:00 AM, Paolo Carlini wrote: + tree ce_index = cxx_constant_value (ce->index); + + if (TREE_CODE (ce_index) == INTEGER_CST) + { /* A C99 designator is OK if it matches the current index. */ - if (TREE_INT_CST_LOW (ce->index) == index) + i

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Paolo Carlini
Hi, On 03/26/2013 03:15 PM, Jason Merrill wrote: On 03/26/2013 10:14 AM, Jason Merrill wrote: On 03/26/2013 09:17 AM, Paolo Carlini wrote: + if (identifier_p (ce->index)) +{ + error ("name %qD used in a GNU-style designated " + "initializer for an array", ce->index); +

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Jason Merrill
On 03/26/2013 10:14 AM, Jason Merrill wrote: On 03/26/2013 09:17 AM, Paolo Carlini wrote: + if (identifier_p (ce->index)) +{ + error ("name %qD used in a GNU-style designated " + "initializer for an array", ce->index); + return false; +} + + tree ce_index = cx

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Jason Merrill
On 03/26/2013 09:17 AM, Paolo Carlini wrote: + if (identifier_p (ce->index)) + { + error ("name %qD used in a GNU-style designated " +"initializer for an array", ce->index); + return false; + } + + tree ce_index = cxx_constant_value (ce->index

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Paolo Carlini
Hi, On 03/26/2013 01:32 PM, Jason Merrill wrote: On 03/26/2013 08:09 AM, Paolo Carlini wrote: check_array_designated_initializer is called by reshape_init* with ce->index a CONST_DECL, not an INTEGER_CST. Thus I wondered if in such cases it's just matter of using integral_constant_value on it,

Re: [C++ Patch/RFC] PR 55951

2013-03-26 Thread Jason Merrill
On 03/26/2013 08:09 AM, Paolo Carlini wrote: check_array_designated_initializer is called by reshape_init* with ce->index a CONST_DECL, not an INTEGER_CST. Thus I wondered if in such cases it's just matter of using integral_constant_value on it, thus something like the below (which passes testing

[C++ Patch/RFC] PR 55951

2013-03-26 Thread Paolo Carlini
Hi, in mainline and 4.8, at variance with 4.7, for: enum { A }; static const char *a[] = { [A] = "a" }; check_array_designated_initializer is called by reshape_init* with ce->index a CONST_DECL, not an INTEGER_CST. Thus I wondered if in such cases it's just matter of using integral_constan