🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Internal error in ms compiler

Started by
-1 comments, last by Waterlimon 9 years ago

2>  Running Code Analysis for C/C++...
2>c:\users\waterlimon\documents\coopsurvivalgit\engine\src\Callback.h(29): fatal error C1001: An internal error has occurred in the compiler.
2>  (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\yyaction.cpp', line 4860)
2>   To work around this problem, try simplifying or changing the program near the locations listed above.
2>  Please choose the Technical Support command on the Visual C++ 
2>   Help menu, or open the Technical Support help file for more information
2>          ..\..\Src\Game.cpp(30) : see reference to function template instantiation 'void wle::data::CallbackBase<void,wle::io::Window &,const wle::io::ButtonEvent &>::connectMemberFunction<game::Game,void game::Game::OnButtonEvent(wle::io::Window &,const wle::io::ButtonEvent &)>(ClassT *)' being compiled
2>          with
2>          [
2>              ClassT=game::Game
2>          ]
2>          ..\..\Src\Game.cpp(143) : see reference to function template instantiation 'void wle::data::CallbackBase<void,wle::io::Window &,const wle::io::ButtonEvent &>::connectMemberFunction<game::Game,void game::Game::OnButtonEvent(wle::io::Window &,const wle::io::ButtonEvent &)>(ClassT *)' being compiled
2>          with
2>          [
2>              ClassT=game::Game
2>          ]
2>c1xxast : fatal error C1001: An internal error has occurred in the compiler.
2>  (compiler file 'msc1ast.cpp', line 1325)
2>   To work around this problem, try simplifying or changing the program near the locations listed above.
2>  Please choose the Technical Support command on the Visual C++ 
2>   Help menu, or open the Technical Support help file for more information
2>

Well it looks likes theres two internal errors but whatever.

It compiles fine.

The line it complains about (29) is in a method in a class that looks like (removed some unrelevant stuff):


template<typename ReturnT, typename... ParamT>
class CallbackBase
{
	//Member func as free function
	typedef ReturnT(*MFuncT)(void*, ParamT...);
	//free function
	typedef ReturnT(*FuncT)(ParamT...);
public:
	template<typename ClassT, ReturnT(ClassT::*memberFunc)(ParamT...)>
	void connectMemberFunction(ClassT* object)
	{
		mObject = object;
                //THE FOLLOWING LINE CAUSES INTERNAL COMPILATOR CRASHERROR IN MICROSOFT OPTIMIZING COMPILER .exe
		mMemberFunction = &memberFunctionPtrAsFreeFunction < ClassT, decltype(memberFunc), memberFunc, ParamT... > ;
	}
protected:
	template<typename ClassT, typename MemberFuncT, MemberFuncT memberFunc, typename... SuppliedParamT>
	static ReturnT memberFunctionPtrAsFreeFunction(void* object, SuppliedParamT... params)
	{
		return (static_cast<ClassT*>(object)->*memberFunc)(params...);
	}
	void* mObject = nullptr;
	union
	{
		MFuncT mMemberFunction;
		FuncT mFunction;
	};
};

I mean Im just declaring a template class template method that sets a pointer to a static template method parametrized by a template parameter, the type of a member function pointer template parameter dependent on the first one, the value of that member function pointer template parameter, and an unpacked variadic template parameter list. How on earth could that hit some rarely visited and thus poorly tested corner in the compiler while running static analysis with 64 bit compile target?

EDIT: VS 2013 community edition, and compiles/runs fine

o3o

This topic is closed to new replies.

Advertisement