http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50013
Summary: Internal compiler error: Error reporting routines
re-entered using decltype
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
namespace functor
{
template <class ret,class fparam,class... param>
class Functor
{
public:
virtual ret exec(fparam,param...) = 0;
};
template<class ret>
class Functor<ret,void>
{
public:
virtual ret exec(void) = 0;
};
template <class ret,class type,class fparam,class... param>
class Function : public Functor<ret,fparam,param...>
{
public:
Function(ret(type::*f)(fparam,param...),type* t) : obj(t), func(f)
{
}
virtual ret exec(fparam fp,param... p)
{
return (obj->*func)(fp, p...);
}
protected:
type* obj;
ret(type::*func)(fparam,param...);
};
template<class ret,class type>
class Function <ret,type,void> : public Functor<ret,void>
{
public:
template<typename...>
class Default;
public:
Function(ret(type::*f)(void), type* t) : obj(t), func(f)
{
}
virtual ret exec()
{
return (obj->*func)();
}
protected:
type* obj;
ret(type::*func)(void);
};
template<typename ret, typename type>
template<typename fdefault>
class Function<ret, type, void>::Default<fdefault> : public Functor<ret,
void>, public Function<ret, type, fdefault>
{
public:
Default(decltype(Function<ret, type, fdefault>::func) f, type* t,
fdefault fd) : Function<ret, type, fdefault>(f, t), save(fd)
{
}
virtual ret exec()
{
return (obj->*func)(save);
}
protected:
fdefault save;
};
}
class Test
{
public:
void test(int) {};
};
int main()
{
Test test;
functor::Function<void,Test,void>::Default<int>(&Test::test, &test, 10);
}
fabian@ubuntu:~$ g++ test.cpp -o test -std=c++0x
test.cpp: In instantiation of ‘functor::Function<void, Test,
void>::Default<int>’:
test.cpp:83:72: instantiated from here
test.cpp:32:36: error: ‘void (Test::* functor::Function<void, Test,
int>::func)(int)’ is protected
test.cpp:60:4: error: within this context
test.cpp:32:36: error: ‘void (Test::* functor::Function<void, Test,
int>::func)(int)’ is protected
test.cpp:60:58: error: within this context
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
If someone could explain if test.cpp:60 really is an error and if so, how to do
it instead, I would be very grateful.