[Bug c++/63522] [4.8/4.9/5 Regression] ICE: unexpected expression 'ElementIndices' of kind template_parm_index

aaron.mcdaid at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 13 17:31:00 GMT 2015


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

aaron.mcdaid at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aaron.mcdaid at gmail dot com

--- Comment #5 from aaron.mcdaid at gmail dot com ---
Hi,
In which versions has this been fixed? I'm running 4.9.3 and it crashes with
this fragment. I had assumed that 4.9.3 was very up-to-date (as of July 2015).

Perhaps this was fixed in the 5.x series and wasn't included in the recent
4.9.3 release?

I also have a different piece of code that gives a very similar error. I'm not
sure if I've found a new bug or not. In the following code, it will compile
cleanly if I put a return statement inside function template `a`, or if I
replace the return type with the simpler (non-decltype) version that is
currently commented out. Otherwise it crashes with "
unexpected expression ‘i’ of kind template_parm_index"

  ~/prefix-gcc-4.9.3/bin/g++ -std=c++11 -Wall -Wextra


template<int i>
struct int_c {
    static
    constexpr int value = i;
};

template<int... c>
struct Pack {
};


template<int... i>
static
auto a() ->
Pack< decltype(int_c<i>()) :: value ... >
//Pack<  int_c<i>          :: value ... >
{
}

int main() {
    a<0>();
}


More information about the Gcc-bugs mailing list