This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug pending/16313] New: Function's address automatically taken


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]