public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* why this testcase compile failed for gcc.
@ 2011-02-17  7:42 zhang qingshan
  2011-02-18 15:08 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: zhang qingshan @ 2011-02-17  7:42 UTC (permalink / raw)
  To: gcc-help

/* ------- 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-02-22 19:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17  7:42 why this testcase compile failed for gcc zhang qingshan
2011-02-18 15:08 ` Ian Lance Taylor
2011-02-18 17:36   ` Marc Glisse
2011-02-21  6:31     ` zhang qingshan
2011-02-21 11:18   ` zhang qingshan
2011-02-21 11:28     ` Jonathan Wakely
2011-02-21 16:00     ` Ian Lance Taylor
2011-02-22 19:10       ` Andi Hellmund
2011-02-22 19:18         ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).