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++/53349] Internal compiler error with constexpr and recursive data type.


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

Daniel KrÃgler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2012-05-15 10:53:22 UTC ---
I can confirm this for gcc 4.8.0 20120513 (experimental).

A current workaround is to replace the member declaration

constexpr Foo(const Foo<N-1> a) : m_a(a)     {}

by

constexpr Foo(const Foo<N-1>& a) : m_a(a)     {}

The following is a simplified form of the problem:

template<int N>
struct Foo {
  constexpr Foo(const Foo<N-1> a) : m_a(a)     {} // Line 3
  constexpr Foo(const Foo<N> &a)  : m_a(a.m_a) {}
  Foo<N-1> m_a;
};

template <> struct Foo<0> {};

constexpr auto res = Foo<2>(Foo<1>(Foo<0>())); // Line 10

10|  in constexpr expansion of 'Foo<2>(Foo<1>((*(const Foo<1>*)(&
Foo<1>((Foo<0>((* & Foo<0>())), Foo<0>()))))))'|
3|  in constexpr expansion of '((Foo<2>*)this)->Foo<2>::m_a.Foo<N>::Foo<1>((* &
a))'|
10|internal compiler error: in cxx_eval_indirect_ref, at cp/semantics.c:7408|


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