- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[bash]struct X { X() {} X(X const& obj) {} ~X() {} void operator = (X const&) {} void exec() const {} }; templatevoid exec(T f) { f(); } int main() { X t; exec([=](){t.exec();}); } [/bash]
In Win32 configuration compiles successfully, but in x64 configuration I get the following error:
Compiling with Intel C++ Compiler 11.1.071 [IA-32]... (Intel C++ Environment)
.\\lambda_bug.cpp(55): error: class "X" has no suitable copy constructorX t;
^
detected during implicit generation of "__lambda1::
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like you are using Composer Update3.
Please check whether
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Of course I set Enable C++0x Support = Yes (/Qstd=c++0x) before working with lambdas. And yes, it's Parallel Studio SP1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also error message is wrong
\lambda_bug.cpp(55): error: class "X" has no suitable copy constructor
X t;
^
detected during implicit generation of "__lambda1::
Should read
... "__lambda1::
The incorrect error message had me blank staring at code for several hours.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jennifer,
Additional info.
I added to my copy constructor a defensive validator and code to correct the errant input arg should it fail verification (and verify assumed corrected reference, _ASSERT if uncorrectable).
However, now instead of calling
T(const volatile T& ref);
The compiler is calling
T(volatile T& ref);
The code I added can be conditionalized in or out. Excepting for line breaks and (conditionalize out code). The new copy of the code "should" compile the same as yesterdays code. But it does not.
My guess is the compiler is using Lambda functions and a reference to a token is getting screwed-up. The junk being used for the token is flipping the choice of copy constructors.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Brandon,
It is not a show stopper for me since I've written code to on-the-fly fix the error (when error present). A little slower execution. I've just downloaded the Parallel Composer update 5, but haven't installed. I do not know if this problem is present or not in update 5.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reproduced the problem on update 5 as well.
A workaround suggested by our front-end team is to use a reference lambda instead of copying i.e.:
[cpp]exec([&](){t.exec();});[/cpp]
We are lookinginto fixing this for the next major compiler version. If a fix in 11.1 or the current Intel Parallel Composer is needed, let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is resolved in the 12.0 compiler that's part of Intel Parallel Composer 2011 and Composer XE 2011 products. Let us know if there's any problems.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page