[LC++]template code not accepted by GCC 3.0.4

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Wed May 15 04:05:08 UTC 2002


My girlfriend has some code that used to compile with GCC 2.95, but
received a report from a GCC 3.0.4 user that some code does not
compile. This is a typedef of a specialization of std::set.
Since we can't upgrade to GCC 3.0.4 at home (I don't want to mess
my Linux box, and have not enough disk space atm, and last time I
tried to upgrade to 2.95.3, nasty things happened (though I managed
to recover the trouble)), and that the latest cygwin version still
sports 2.95.3 for win2k box at work, we can't test anything.

This is some code that feature the faulty lines, in hope that it
actually fails to compile with 3.0.4. It does compile with 2.95.
I'd appreciate if someone could point out what actually is wrong.
Before you say that, yes, I do know that it misses a using namespace
STL declaration (we found that GCC oddly doesn't honor the std
namespace by default, probably for backward compatibility reasons),
but fully qualifying std::set does not help.

The error messages reported by the GCC 3.0.4 user were, depending
on some variations my girlfriend asked him to make:

(non verbatim):
ISO standard forbids to declare 'set' without type
template-id 'set<Place>' can't be used as a declarator

and (verbatim):
src/selected.h:31: `set' is not a template
src/selected.h:31: ISO C++ forbids declaration of `set2d' with no type

This is the actual snippet. The original code can be found in the
eme package at http://annie.kezako.net/eme/

#include <set>

class C {

class A {
  typedef set<C> my_set;

int main()
  return 0;


Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20020515/3c69019d/attachment.htm 

More information about the tuxCPProgramming mailing list