//class we're trying to generate
template <int a, foo b>
class A
{
public:
A()
{
std::cout << a << "," << (int)b << std::endl;
}
};
//class which generates information
template <typename T>
struct B
{
typedef T value_type;
static const T val;
};
template <typename... B>
struct madscience_intitializer
{
template <typename B::value_type... args>
using ret_type = A<args...>;
};
int main()
{
madscience_intitializer<B<int>,B<foo> >::ret_type<1,foo::y> a;
}
在 G++ 中,我得到
/home/njclimer/source/testdir/main/main2.cpp: In function 'int main()':
/home/njclimer/source/testdir/main/main2.cpp:38:61: internal compiler error: in dependent_type_p, at cp/pt.c:19526
madscience_intitializer<B<int>,B<foo> >::ret_type<1,foo::y> a;
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccAhk6TK.out file, please attach this to your bugreport.
有没有其他人遇到过这个?这是编译器的实际错误还是我的代码中的错误?
我在跑
g++ (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
^
带有标志 -std=gnu++0x -O2 -g