internal compiler error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

internal compiler error

spamjunk
I get an internal compiler error when I try to compile the sample code
below with 4.8.1 (it builds fine with 4.7.2).

Thanks for your time.

The error message is:

bug.cpp: In instantiation of 'struct seq_t<int, 123, 5>::gen<1, 123,
123, 123, 123>':
bug.cpp:11:12:   recursively required from 'struct seq_t<int, 123,
5>::gen<4, 123>'
bug.cpp:11:12:   required from 'struct seq_t<int, 123, 5>::gen<5>'
bug.cpp:21:59:   required from 'static constexpr seq_t<E, V,
CNT>::bits_t seq_t<E, V, CNT>::init() [
with E = int; E V = 123; int CNT = 5]'
bug.cpp:30:42:   required from here
bug.cpp:11:12: internal compiler error: in tsubst, at cp/pt.c:11306
      struct gen : gen<N - 1, V, Es...>{};
             ^

The code:

#include <iostream>

using namespace std;

template<class E, E V, int CNT>
struct seq_t
{
     template<E... Es> struct seq{};

     template<int N, E... Es>
     struct gen : gen<N - 1, V, Es...>{};

     template<E... Es>
     struct gen<0, Es...> : seq<Es...>{};

     struct bits_t{ E e[CNT]; };

     template<E... Es>
     static constexpr bits_t init(seq<Es...>) {return {{Es...}};}

     static constexpr bits_t init() {return init(gen<CNT>{});}
};



int main()
{
     typedef seq_t<int, 123, 5> wow;

     constexpr wow::bits_t bits(wow::init());

     cout << bits.e[0] << endl;
     cout << bits.e[1] << endl;
     cout << bits.e[2] << endl;
     cout << bits.e[3] << endl;
     cout << bits.e[4] << endl;
}




------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: internal compiler error

niXman
2013/9/7 spamjunk:

> I get an internal compiler error when I try to compile the sample code
> below with 4.8.1 (it builds fine with 4.7.2).
>
> Thanks for your time.
>
> The error message is:
>
> bug.cpp: In instantiation of 'struct seq_t<int, 123, 5>::gen<1, 123,
> 123, 123, 123>':
> bug.cpp:11:12:   recursively required from 'struct seq_t<int, 123,
> 5>::gen<4, 123>'
> bug.cpp:11:12:   required from 'struct seq_t<int, 123, 5>::gen<5>'
> bug.cpp:21:59:   required from 'static constexpr seq_t<E, V,
> CNT>::bits_t seq_t<E, V, CNT>::init() [
> with E = int; E V = 123; int CNT = 5]'
> bug.cpp:30:42:   required from here
> bug.cpp:11:12: internal compiler error: in tsubst, at cp/pt.c:11306
>       struct gen : gen<N - 1, V, Es...>{};
>              ^
>
> The code:
>
> #include <iostream>
>
> using namespace std;
>
> template<class E, E V, int CNT>
> struct seq_t
> {
>      template<E... Es> struct seq{};
>
>      template<int N, E... Es>
>      struct gen : gen<N - 1, V, Es...>{};
>
>      template<E... Es>
>      struct gen<0, Es...> : seq<Es...>{};
>
>      struct bits_t{ E e[CNT]; };
>
>      template<E... Es>
>      static constexpr bits_t init(seq<Es...>) {return {{Es...}};}
>
>      static constexpr bits_t init() {return init(gen<CNT>{});}
> };
>
>
>
> int main()
> {
>      typedef seq_t<int, 123, 5> wow;
>
>      constexpr wow::bits_t bits(wow::init());
>
>      cout << bits.e[0] << endl;
>      cout << bits.e[1] << endl;
>      cout << bits.e[2] << endl;
>      cout << bits.e[3] << endl;
>      cout << bits.e[4] << endl;
> }
>

This is GCC bug. Please fill bugreport and post link here. Thanks.


--
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: internal compiler error

spamjunk

On 9/7/2013 12:21 AM, niXman wrote:
> This is GCC bug. Please fill bugreport and post link here. Thanks.

Thanks. I submitted a bug report with GCC.

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



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe