Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
14 Views

Bug report: Internal Error with member function pointer

I am getting an internal error when trying to compile the test case below. It compiles with no problem with Apple GCC 4.2.1, GNU GCC 4.5.2, clang++ 2.8, and Intel 11.1 091.
I am trying to pass a member function pointer (&C2::func2) to a template member template function (C2::Tfunc), where the template function argument for the member-function-pointer type is a template argument. This fails if the member function pointer is for a function that has a default argument and the class that contains the member function is also a template.
class C1 shows that this works just fine when the class is not a template class. class C2 shows that it works for a function where the argument does not have a default value, but does fail when the function has a default argument.
Compiler version: 2011.1.122 (12.0.0)
OS: Mac OS X 10.6.6
Test case:
#include
#include
class C1 {
public:
int func1(int i) {
return i;
}
int func2(int i = int()) {
return i;
}
template
A Tfunc(F f, A a) {
return a;
}
int test() {
int i = int();
int j = this->Tfunc(&C1::func1, i); // OK
int k = this->Tfunc(&C1::func2, j); // OK
return k;
}
};
template
class C2 {
public:
X func1(X i) {
return i;
}
X func2(X i = X()) {
return i;
}
template
A Tfunc(F f, A a) {
return a;
}
X test() {
X i = X();
X j = this->Tfunc(&C2::func1, i); // OK without default argument value
X k = this->Tfunc(&C2::func2, j); // Error: Template class with function
// pointer to a function with default value
return k;
}
};
int main(void) {
C1 c1;
c1.test();
C2 c2;
c2.test();
return EXIT_SUCCESS;
}
Compiler output:
/opt/intel/bin/icpc -O2 -g -Wall -fmessage-length=0 -c -o test.o test.cpp
test.cpp(54): internal error: assertion failed: instantiate_default_arguments_of_template_matching: template not found (shared/edgcpfe/overload.c, line 5225)
X k = this->Tfunc(&C2::func2, j); // Error: Template class with function
^
compilation aborted for test.cpp (code 4)
0 Kudos
2 Replies
Highlighted
Employee
14 Views

I have reproduced the issue. I have submitted a report to Intel compiler development team on this. I will update this thread when I have more information on this.

Om Sachan
Intel compiler support

0 Kudos
Highlighted
Employee
14 Views

The issue has been fixed in Intel Composer XE update 3. The compiler is available for download from https://registrationcenter.intel.com/.
0 Kudos