Eclipse (4.2) gibt vor, Symbol gäbe es nicht (Templateproblem)



  • void bar(int i)
    {
    	std::cout << "bar(" << i << ')' << std::endl;
    }
    
    template<typename ... Args>
    class Foo
    {
    public:
    	template<void (*TMethod)(Args...)>
    	static void bind(Args... args)
    	{
    		TMethod(args...);
    	}
    };
    
    int main()
    {
    	Foo<int>::bind<bar>(20);
    }
    

    Eclipse behauptet in Zeile 19:

    • Symbol 'bind' could not be resolved
    • Invalid arguments ' Candidates are: void

    g++ allerdings kompiliert ohne Probleme und führt das Programm aus. Gibt es einen Trick, Eclipse davon zu überzeugen, dass es diese Methode wirklich gibt?

    Es gibt übrigens keine Probleme, wenn man schreibt:

    template<void (*TMethod)(int)>
    static void bind(Args... args)
    {
    	TMethod(args...);
    }
    

    PS.: Wie das Problem zu stande kommt weiß ich, aber wie behebe ich, dass Eclipse genausoviel weiß wie wie der Compiler?
    bereits ausprobiert:

    • Indexer -> Rebuild etc.
    • clean&build Project
    • Eclipse neustarten

Anmelden zum Antworten