public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22596] New: Impossible to explicitly instantiate particular overloaded function
@ 2005-07-21 18:48 phenning at lanl dot gov
  2005-07-21 18:57 ` [Bug c++/22596] " phenning at lanl dot gov
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: phenning at lanl dot gov @ 2005-07-21 18:48 UTC (permalink / raw)
  To: gcc-bugs

Compiling the following code with "g++ -c -fno-implict-templates" always generates code for the 
second definition of foo().  It appears that g++ is automatically deducing the template parameters from 
the function parameters, even though the template parameters are explicitly given in the explict 
instantiation.   This problem prevents explicitly instantiating the function

std::_Destroy<int*, std::allocator<int>>(int *, int *, std::allocator<int>);

from bits/stl_construct.h in the 4.x Common Library implementation.

This behavior has been seen in: 
i686-pc-linux-gnu gcc-3.4.2
powerpc-apple-darwin8 gcc-4.0.0 (20041026 Apple Computer build 4061) 
i686-pc-linux-gnu gcc-4.1.0 20050629 (experimental)

// -------------------------------

template<class T> struct A_class
{
  int do_it(int i) { return i+1; }
};

template<class A> int foo(A a)
{
  return a.do_it(1);
}

template<class A, class T> int foo(A_class<T> a)
{
  return a.do_it(2);
}

template int foo< A_class<int> >(A_class<int> a);

// -------------------------------

-- 
           Summary: Impossible to explicitly instantiate particular
                    overloaded function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phenning at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu, powerpc-apple-darwin8


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


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-22596-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-06-22 17:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-21 18:48 [Bug c++/22596] New: Impossible to explicitly instantiate particular overloaded function phenning at lanl dot gov
2005-07-21 18:57 ` [Bug c++/22596] " phenning at lanl dot gov
2005-07-21 18:58 ` pinskia at gcc dot gnu dot org
2005-07-21 19:16 ` pinskia at gcc dot gnu dot org
2005-07-21 19:34 ` phenning at lanl dot gov
2005-07-21 23:19 ` bangerth at dealii dot org
2005-07-21 23:30 ` phenning at lanl dot gov
2005-07-22  0:34 ` bangerth at dealii dot org
2005-07-26 20:43 ` pinskia at gcc dot gnu dot org
     [not found] <bug-22596-4@http.gcc.gnu.org/bugzilla/>
2011-06-22 16:07 ` jason at gcc dot gnu.org
2011-06-22 17:35 ` jason at gcc dot gnu.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).