https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92432

            Bug ID: 92432
           Summary: Regression: ICE on non-constant expression as template
                    argument
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at ekpyron dot org
  Target Milestone: ---

Found on an up-to-date x86_64 archlinux system using "gcc 9.2.0-4".

However, I think this affects all versions of gcc >= 8.0 and is independent of
the archlinux package.

Source code:

#include <array>
template<typename T> static constexpr void t(std::initializer_list<int> x) {
std::array<int, x.size()> v; }



Results in:

t.cpp: In function 'constexpr void t(std::initializer_list<int>)':
t.cpp:2:102: internal compiler error: in coerce_template_parms, at cp/pt.c:8625



Expected (this should be what gcc < 8.0 does):

t.cpp: In function 'constexpr void t(std::initializer_list<int>)':
t.cpp:2:100:   in constexpr expansion of 'x.std::initializer_list<int>::size()'
t.cpp:2:102: error: 'x' is not a constant expression



I hope this is not a duplicate, but a search for "cp/pt.c:8625" yielded no
results, so I guess this is new.

Reply via email to