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 c++/15711] New: unable to take address of function template specilization


I expect the following to compile, but it gives a strange error, especially
considering the function is not overloaded and there is only one instantiation
of the template.

template<typename T>
void foo()
{
}

int main()
{
  &foo<int>;  //error: statement cannot resolve address of overloaded function
}




$ g++ -v -save-temps test.cpp 2>&1 | grep -v ignoring
Reading specs from /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ./configure
--prefix=/home/coryan/HEAD/specs/BUILD//usr/local/gcc-3.4.0 --enable-threads
Thread model: posix
gcc version 3.4.0
 /usr/local/gcc-3.4.0/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E
-quiet -v -iprefix /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/
-D_GNU_SOURCE test.cpp -mtune=pentiumpro -o test.ii
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0
 /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/i686-pc-linux-gnu
 /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/backward
 /usr/local/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/local/include
 /usr/include
End of search list.
 /usr/local/gcc-3.4.0/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus
-fpreprocessed test.ii -quiet -dumpbase test.cpp -mtune=pentiumpro -auxbase test
-version -o test.s
GNU C++ version 3.4.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test.cpp: In function `int main()':
test.cpp:8: error: statement cannot resolve address of overloaded function

-- 
           Summary: unable to take address of function template
                    specilization
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at uzdavinis dot com
                CC: gcc-bugs at gcc dot gnu dot org,pbrannan at atdesk dot
                    com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15711


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