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

--- Comment #3 from Paul Keir <pkeir at outlook dot com> 2013-02-19 12:18:17 
UTC ---
I've added gcc472aliastemplatebug.cpp which also displays an unexpected error;
shown below along with the code. This is hopefully a related (and simpler)
example. Also, by using the non-template alias, "ein2", and uncommenting the
last two statements of "test", an internal compiler error occurs. Again, an
online 4.8.0 compiler gives the same errors.

template <int ...Is>
struct is1 {};

template <typename, int, int>
struct ein_helper;

template <int ...Is, int N>
struct ein_helper<is1<Is...>,N,N> {
  typedef is1<Is...> type;
};

template <int ...Is, int N, int Ne>
struct ein_helper<is1<Is...>,N,Ne> {
  typedef typename ein_helper<is1<Is...,N>,N+1,Ne>::type type;
};

template <typename T>
using ein1 = typename ein_helper<is1<>,0,5>::type;

using ein2 = typename ein_helper<is1<>,0,5>::type;

template <template <int ...> class C, int ...Is>
inline void burst(C<Is...> const &arg_ixs) {}

void test() {
  ein1<int> abc;
//  ein2      abc; // Use instead for an internal compiler error
  burst(abc);
}

// Error messages:

gcc472aliastemplatebug.cpp: In function ‘void test()’:
gcc472aliastemplatebug.cpp:28:12: error: no matching function for call to
‘burst(ein1<int>&)’
gcc472aliastemplatebug.cpp:28:12: note: candidate is:
gcc472aliastemplatebug.cpp:23:13: note: template<template<int ...<anonymous> >
class C, int ...Is> void burst(const C<Is ...>&)
gcc472aliastemplatebug.cpp:23:13: note:   template argument
deduction/substitution failed:
gcc472aliastemplatebug.cpp:28:12: error: type/value mismatch at argument 1 in
template parameter list for ‘template<int ...<anonymous> > class C’
gcc472aliastemplatebug.cpp:28:12: error:   expected a constant of type ‘int’,
got ‘int’

// Internal compiler error:

gcc472aliastemplatebug.cpp: In function ‘void test()’:
gcc472aliastemplatebug.cpp:28:12: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.

Reply via email to