Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

lambda to std::function conversion issues

vpozdyayev
Beginner
331 Views
Hello.
I was wondering if the following is a known issue and/or has a workaround. This code fails to compile when any of the problematic lines is uncommented (error messages are provided in comments):
#include 

template< typename some_type >
class some_class {
public:
	void fn1() {
		auto qwe = [](){};
		auto asd = ( std::function< void() > )qwe;
	}
	static void fn2() {
		auto qwe = [](){};
		auto asd = ( std::function< void() > )qwe;
	}
	void fn3( std::function< void() > f ) {
		std::function< void() > _f = (){f();};
	}
	void fn4( const std::function< void() > &f ) {
		std::function< void() > _f = (){f();};
	}
};

int main() {
	some_class x;
	// uncomment any of the followings 4 lines:
	x.fn1(); // internal error: backend signals
	//some_class::fn2(); // internal error: backend signals
	//x.fn3( [](){} ); // internal error: type_pointed_to: not a pointer type
	//x.fn4( [](){} ); // internal error: backend signals
	return 0;
}
This also fails:
class some_non_template_class {
public:
	void fn3( std::function< void() > f ) {
		std::function< void() > _f = (){f();}; // internal error: type_pointed_to: not a pointer type
	}
};
Versions:
Intel C++ Compiler XE for applications running on IA-32, Version 12.1.2.278 Build 20111128;
MSVS 2010 SP1 (MSVC compiles this just fine).
Have tried compiling from IDE, and also with just "icl main.cpp"
----
Vladimir
0 Kudos
4 Replies
Georg_Z_Intel
Employee
331 Views
Hello Vladimir,

all the errors you see (named internal error) are compiler defects. I've submitted a defect (edit: DPD200177954) to our engineers to fix this. I'm also asking them for workarounds and come back to you as soon as I have more information.

Sorry for the inconvenience & best regards,

Georg Zitzlsberger
0 Kudos
tehpikachu
Beginner
331 Views
my sig
Thanks a lot, had a similar problem myself was wondering what was going on.
0 Kudos
vpozdyayev
Beginner
331 Views
Thank you, Georg.
0 Kudos
Georg_Z_Intel
Employee
331 Views
Hello,

those internal compiler errors just got fixed and will be available with Intel Composer XE 2011 Update 10.

Best regards,

Georg Zitzlsberger
0 Kudos
Reply