- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a potential problem in the C++ compiler. I can reproduce it using following code, which works OK in Clang 3.2 or G++ 4.8.1:
#include <functional>
#include <cstdio>
class T
{
public:
void dosth(int& a, const int* b)
{
a=*b;
}
};
int main(void)
{
T tt;
int a=1;
int b=10;
auto func=std::bind(&T::dosth, &tt, std::ref(a), &b);
func();
printf("%d\n",a);
}
The version I am using is:
icc (ICC) 13.1.1 20130313
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Is there a solution for this?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently, you must have used g++ -std=c++11.
You could file a problem report on premier.intel.com, as any internal error is a reportable bug. On another icpc version I get:
xs.cpp(20): error: no instance of overloaded function "std::_Bind<_Functor (_Bound_args...)>::operator() [with _Functor=std::_Mem_fn<void (T::*)(int &, const int *)>, _Bound_args=<T *, std::reference_wrapper<int>, int *>]" matches the argument list
object type is: std::_Bind<std::_Mem_fn<void (T::*)(int &, const int *)> (T *, std::reference_wrapper<int>, int *)>
func ();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Xiaoge,
I tried with 'icc version 13.1.1 (gcc version 4.4.6 compatibility)' and 'icc version 14.0.0 (gcc version 4.4.6 compatibility)' ,the executable both output the value '10' ,so what's your gcc version ?also the compilation options should be 'icc -std=c++11 *.cpp'
Thank you.
--
QIAOMIN.Q
Intel Developer Support
Please participate in our redesigned community support web site:
Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As mentioned before, I am using gcc 4.8.1. My ICC version looks to be icc version 13.1.1 (gcc version 4.7.0 compatibility), and I used the -std=c++11 parameter.
But it looks like a problem in EDG frontend?
QIAOMIN Q. (Intel) wrote:
Hello Xiaoge,
I tried with 'icc version 13.1.1 (gcc version 4.4.6 compatibility)' and 'icc version 14.0.0 (gcc version 4.4.6 compatibility)' ,the executable both output the value '10' ,so what's your gcc version ?also the compilation options should be 'icc -std=c++11 *.cpp'
Thank you.
--
QIAOMIN.Q
Intel Developer SupportPlease participate in our redesigned community support web site:
Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
that code compiles fine with icc 13.1.3.192 (gcc 4.6.3)
[bash]
casey@convect ~/code/icctest $ icc -o ice -std=c++11 ice.cpp
casey@convect ~/code/icctest $ ./ice
10
casey@convect ~/code/icctest $ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.3.192 Build 20130607
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.[/bash]
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page