This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
why this testcase compile failed for gcc.
- From: zhang qingshan <steven dot zhang54373 at gmail dot com>
- To: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Thu, 17 Feb 2011 14:31:34 +0800
- Subject: why this testcase compile failed for gcc.
/* ------- test case -------------------*/
void x();
template <typename T>
void foo(const T*);
int main() {
foo(x);
}
GCC 4.5 complains:
a.cpp: In function 'int main()':
a.cpp:6: error: no matching function for call to 'foo(void (&)())'
It seems that, const T * is resolved as void (&)());
IMO, T --> void (), const T --> void (), const T * --> void (*)(), and
it should be leagle.
Thanks