http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53494

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.3
            Summary|initializer lists in array  |[4.7/4.8 Regression] ICE
                   |type                        |with invalid initializer
                   |                            |list

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-26 
15:08:59 UTC ---
further reduced

#include <utility>
using std::pair;

template<typename T>
struct array
{
  typedef T value_type;
  value_type data[1];
};

struct string
{
  string(const char*) { }
};

array<pair<string, unsigned> const> const matchSynonyms{ {"smile",1} };

4.6 correctly rejects it:

a.cc:16:70: error: too many initializers for 'array<const std::pair<string,
unsigned int> >::value_type [1] {aka const std::pair<string, unsigned int>
[1]}'
a.cc:16:70: error: could not convert '(const char*)"smile"' from 'const char*'
to 'array<const std::pair<string, unsigned int> >::value_type {aka const
std::pair<string, unsigned int>}'

4.7 gives:

'
a.cc:16: confused by earlier errors, bailing out

and 4.8 gives:

'
in strip_typedefs, at cp/tree.c:1196
 array<pair<string, unsigned> const> const matchSynonyms{ {"smile",1} };
                                                                      ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to