This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/50075] New: ICE related to parameter deduction and initializer_list


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

             Bug #: 50075
           Summary: ICE related to parameter deduction and
                    initializer_list
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: z0sh@sogetthis.com
              Host: x86
            Target: x86


[Please rephrase the title with something more appropriate, I don't know how to
pin this down.]

I was trying to deduce the size parameter of an std::array<T,N> from the size
of an initializer list. The following code is probably not correct, but in any
event, it causes GCC 4.6.1 with -std=c++0x to crash:



#include <functional>
#include <array>

template <typename T, unsigned int N>
std::array<T, N> make_array_helper(const std::initializer_list<T> & il)
{
  return std::array<T, N>(il);
}

template <typename T>
auto make_array(const std::initializer_list<T> & il) ->
decltype(make_array(il))
{
  return make_array_helper<T, il.size()>(il);
}

int main()
{
  auto z = make_array({{1,2}});
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]