public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26310]  New: Cannot find base class template method
@ 2006-02-15 23:22 smirolo at hotmail dot com
  2006-02-15 23:24 ` [Bug c++/26310] " smirolo at hotmail dot com
  2006-02-15 23:42 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: smirolo at hotmail dot com @ 2006-02-15 23:22 UTC (permalink / raw)
  To: gcc-bugs

It seems very strange to me, but in the following code,  gcc complains that it
doesn't find 'propagate' with a correct signature though it exist in the base
class as a template method. If I change the name 'propagate' into 'prop', then
it compiles happily.

Sebastien.

template< typename T, typename X >
class propJoin : public joinOp<T> {
public:
  template< typename Iter >
  void propagate( const T& n, Iter first, Iter last ) {
    std::cout << "propJoin<T,X>::propagate( const T& node, Iter first, Iter
last )" << std::endl;
  }
};


class node {
};

class info {
};

class dfgBackProp : public propJoin<node,info>  {
public:
  void propagate( const node& n ) {
    std::vector<info> infos;
    propagate(n,infos.begin(),infos.end());
  }
};

sebastien-mirolos-powerbook-g4-12:~/build/rep smirolo$ g++ -v testTemplate.cc
--save-temps
Using built-in specs.
Target: powerpc-apple-darwin8.4.0
Configured with: /Volumes/Home/Users/smirolo/reference/gcc-4.0.2/configure
--prefix=/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2
--enable-languages=c,c++
Thread model: posix
gcc version 4.0.2

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/libexec/gcc/powerpc-apple-darwin8.4.0/4.0.2/cc1plus
-E -quiet -v -D__DYNAMIC__ -D__APPLE_CC__=1 testTemplate.cc -fPIC
-fpch-preprocess -o testTemplate.ii
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/lib/gcc/powerpc-apple-darwin8.4.0/4.0.2/../../../../powerpc-apple-darwin8.4.0/include"
#include "..." search starts here:
#include <...> search starts here:

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/lib/gcc/powerpc-apple-darwin8.4.0/4.0.2/../../../../include/c++/4.0.2

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/lib/gcc/powerpc-apple-darwin8.4.0/4.0.2/../../../../include/c++/4.0.2/powerpc-apple-darwin8.4.0

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/lib/gcc/powerpc-apple-darwin8.4.0/4.0.2/../../../../include/c++/4.0.2/backward
 /Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/include

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/lib/gcc/powerpc-apple-darwin8.4.0/4.0.2/include
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.

/Volumes/Home/Users/smirolo/installed/local/gcc-4.0.2/libexec/gcc/powerpc-apple-darwin8.4.0/4.0.2/cc1plus
-fpreprocessed testTemplate.ii -fPIC -quiet -dumpbase testTemplate.cc -auxbase
testTemplate -version -o testTemplate.s
GNU C++ version 4.0.2 (powerpc-apple-darwin8.4.0)
        compiled by GNU C version 4.0.1 (Apple Computer, Inc. build 5250).
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
testTemplate.cc: In member function 'void dfgBackProp::propagate(const node&)':
testTemplate.cc:28: error: no matching function for call to
'dfgBackProp::propagate(const node&, __gnu_cxx::__normal_iterator<info*,
std::vector<info, std::allocator<info> > >, __gnu_cxx::__normal_iterator<info*,
std::vector<info, std::allocator<info> > >)'
testTemplate.cc:26: note: candidates are: void dfgBackProp::propagate(const
node&)
sebastien-mirolos-powerbook-g4-12:~/build/rep smirolo$


-- 
           Summary: Cannot find base class template method
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: smirolo at hotmail dot com
  GCC host triplet: powerpc-apple-darwin8.4.0
GCC target triplet: powerpc-apple-darwin8.4.0


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


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

* [Bug c++/26310] Cannot find base class template method
  2006-02-15 23:22 [Bug c++/26310] New: Cannot find base class template method smirolo at hotmail dot com
@ 2006-02-15 23:24 ` smirolo at hotmail dot com
  2006-02-15 23:42 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: smirolo at hotmail dot com @ 2006-02-15 23:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from smirolo at hotmail dot com  2006-02-15 23:24 -------
Created an attachment (id=10858)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10858&action=view)
save-temps generated file


-- 


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


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

* [Bug c++/26310] Cannot find base class template method
  2006-02-15 23:22 [Bug c++/26310] New: Cannot find base class template method smirolo at hotmail dot com
  2006-02-15 23:24 ` [Bug c++/26310] " smirolo at hotmail dot com
@ 2006-02-15 23:42 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-15 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-02-15 23:42 -------
This is not a bug and this is how C++ works.
propagate in dfgBackProp hides the base classes's propagate.

You want to do:
class dfgBackProp : public propJoin<node,info>  {
public:
  using propJoin<node,info>::propagate;
  void propagate( const node& n ) {
    std::vector<info> infos;
    propagate(n,infos.begin(),infos.end());
  }
};


----
With that change this works as expected.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2006-02-15 23:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-15 23:22 [Bug c++/26310] New: Cannot find base class template method smirolo at hotmail dot com
2006-02-15 23:24 ` [Bug c++/26310] " smirolo at hotmail dot com
2006-02-15 23:42 ` pinskia 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).