F
fabio.tesser
Hello all,
I would like to know what you think of this different behaviour
between different versions of gcc.
The following code:
$ cat test_template_friend_function.cpp
////////////////////////////////////
class test {
public:
friend void ftest2(test x) {
}
};
template <class T>
class simple_template
{
public:
void ftest3(T){
ftest2(test());
}
};
int main(int argc, char *argv[]) {
simple_template<int> a;
a.ftest3(0);
}
/////////////////////////////////////////
compiles without errors with gcc version 4.2.4, but give me the
following error with gcc 4.3.2:
$ g++ test_template_friend_function.cpp
test_template_friend_function.cpp: In member function ‘void
simple_template<T>::ftest3(T) [with T = int]’:
test_template_friend_function.cpp:18: instantiated from here
test_template_friend_function.cpp:12: error: no matching function for
call to ‘ftest2(test)’
I know that there is the Argument Dependent Lookup, so the ftest2
should be recognised using the namespace of the types of the function
arguments.
Do you think this is a bug of gcc 4.3.2?
Thank you in advance for answers and/or comments.
Fabio Tesser
I would like to know what you think of this different behaviour
between different versions of gcc.
The following code:
$ cat test_template_friend_function.cpp
////////////////////////////////////
class test {
public:
friend void ftest2(test x) {
}
};
template <class T>
class simple_template
{
public:
void ftest3(T){
ftest2(test());
}
};
int main(int argc, char *argv[]) {
simple_template<int> a;
a.ftest3(0);
}
/////////////////////////////////////////
compiles without errors with gcc version 4.2.4, but give me the
following error with gcc 4.3.2:
$ g++ test_template_friend_function.cpp
test_template_friend_function.cpp: In member function ‘void
simple_template<T>::ftest3(T) [with T = int]’:
test_template_friend_function.cpp:18: instantiated from here
test_template_friend_function.cpp:12: error: no matching function for
call to ‘ftest2(test)’
I know that there is the Argument Dependent Lookup, so the ftest2
should be recognised using the namespace of the types of the function
arguments.
Do you think this is a bug of gcc 4.3.2?
Thank you in advance for answers and/or comments.
Fabio Tesser