This is the mail archive of the gcc@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]

Re: Member Templates Patch



Hi, Mark

On Mon, 8 Sep 1997, Mark Mitchell wrote:

> Below, I've enclosed a patch that fixes all of the member template
> bugs reported by Todd and Oleg.  Their test-cases have also exposed
> some template bugs that are not specific to member templates; I'm
> going to take a look at them, too.  These are diffs against the 970907
> snapshot.
> 
> (Jason, you'll note that I put the pushlevel()/poplevel() pair back in
> begin_member_tempate_processing(), but for a different reason: more
> than one member template might use the same template parameter names.)
> 
> Thanks,

i've built gcc 

sparc-solaris2.5.1
0907 + your patch + .texi patch

and played a bit with member templates:

1. If we're going to havemember templates by default,
   better to enable them in STL. I can provide patch against
   stl_config.h 

2. Something is wrong with member templates. If i enable  
   member templates in STL, your example (and any other code
   which depends on pair.h) chokes with error:

----------------------------------------------------------------------

drabble /scratch/BETA/test$ c++ -c memtem.cc
In file included from /home/room1/kriol/local/include/g++/algobase.h:33,
                 from /home/room1/kriol/local/include/g++/vector.h:31,
                 from /home/room1/kriol/local/include/g++/vector:6,
                 from memtem.cc:2:
/home/room1/kriol/local/include/g++/pair.h:43: parse error before
`template'
/home/room1/kriol/local/include/g++/pair.h:44: missing ';' before right
brace
/home/room1/kriol/local/include/g++/pair.h:46: parse error at null
character
/home/room1/kriol/local/include/g++/pair.h:59: semicolon missing after
declaration of `struct pair<T1,T2>'
In file included from /home/room1/kriol/local/include/g++/vector:6,
                 from memtem.cc:2:
/home/room1/kriol/local/include/g++/vector.h:94: parse error before
`template'
/home/room1/kriol/local/include/g++/vector.h:108: destructors must be
member functions
/home/room1/kriol/local/include/g++/vector.h:108: return type
specification for destructor invalid
/home/room1/kriol/local/include/g++/vector.h:108: declaration of template
`template <class T, class Alloc = class __defa
ult_alloc_template<false,0>> void vector()'
/home/room1/kriol/local/include/g++/vector.h:35: conflicts with previous
declaration `template <class T, class Alloc = c
lass __default_alloc_template<false,0>> class vector<T,Alloc>'
/home/room1/kriol/local/include/g++/vector.h:35: previous non-function
declaration `template <class T, class Alloc = cla
ss __default_alloc_template<false,0>> class vector<T,Alloc>'
/home/room1/kriol/local/include/g++/vector.h:108: conflicts with function
declaration `template <class T, class Alloc =
class __default_alloc_template<false,0>> void vector()'
/home/room1/kriol/local/include/g++/vector.h:112: `T' was not declared in
this scope
/home/room1/kriol/local/include/g++/vector.h:112: `Alloc' was not declared
in this scope
/home/room1/kriol/local/include/g++/vector.h:112: confused by earlier
errors, bailing out

--------------------------------------------------------------------------

#include <iostream.h>
#include <vector>
#include <list>
#include <string>

int
main() {
  list<string> l;
  l.push_back("member");
  l.push_back("templates");
  l.push_back("work");

  vector<string> v(l.begin(), l.end());
  
  for (vector<string>::iterator i = v.begin();
       i != v.end();
       ++i) {
    cout << *i << " ";
  }
  cout << "\n";
}




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