public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug pending/16313] New: Function's address automatically taken
@ 2004-07-01 10:31 gcc-bugzilla at gcc dot gnu dot org
2004-07-01 11:46 ` [Bug c++/16313] " reichelt at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-01 10:31 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1882 bytes --]
NOTE: Defaulting component because reported component no longer exists
Consider the following piece of code:
void foo (){}
template < typename T >
void
bar (const T &arg)
{
(void) arg;
}
int
main ()
{
bar (foo);
}
G++ 3.3, 3.4, and ICC 7.1 consider it invalid: bar (foo) must be
written bar (&foo). Nevertheless 3.5 accepts it. I'm tempted to say
this piece of code is invalid, but IANALL :)
Environment:
System: Linux nostromo 2.4.25 #2 Mon Mar 15 12:03:26 CET 2004 i686 GNU/Linux
Architecture: i686
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls --enable-threads=posix --without-included-gettext --disable-werror --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk i486-linux-gnu
How-To-Repeat:
~/tmp % icc foo.cc
foo.cc(18): error: no instance of function template "bar" matches the argument list
argument types are: (void ())
bar (foo);
^
compilation aborted for foo.cc (code 2)
~/tmp % g++-3.4 foo.cc
foo.cc: In function `int main()':
foo.cc:18: error: pas de fonction concordante pour l'appel de «bar(void (&)())»
~/tmp % g++-3.5 foo.cc
~/tmp %
--
Summary: Function's address automatically taken
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: pending
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: akim at lrde dot epita dot fr
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i486-pc-linux-gnu
GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16313
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/16313] Function's address automatically taken
2004-07-01 10:31 [Bug pending/16313] New: Function's address automatically taken gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-01 11:46 ` reichelt at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-07-01 11:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-07-01 11:46 -------
Your code is valid, so mainline's behavior is correct.
GCC 3.4.1 will also accept it.
An explanation and the patches that fixed the compiler can be found
in PR 3518.
Btw, your code is accepted by gcc 2.95.x, rejected by gcc 3.0.x,
again accepted by gcc 3.1 - 3.2.1, again rejected by gcc 3.2.2 - 3.4.0,
and (hopefully) finally accepted by 3.4.1 and later. ICC 8.0 also accepts
the code.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|pending |c++
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16313
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-01 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01 10:31 [Bug pending/16313] New: Function's address automatically taken gcc-bugzilla at gcc dot gnu dot org
2004-07-01 11:46 ` [Bug c++/16313] " reichelt at gcc dot gnu dot org
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).