From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10700 invoked by alias); 12 Feb 2005 03:46:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10682 invoked by uid 48); 12 Feb 2005 03:46:37 -0000 Date: Sat, 12 Feb 2005 16:24:00 -0000 From: "kent at sas dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050212034634.19919.kent@sas.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19919] New: [regression 3.3/3.4.4.0] X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg01152.txt.bz2 List-Id: this snippet from firebird "vulcan" project. it compiles with gcc 3.2 sorry, i'm still learning what i can cut out of the sample and still have it be valid C++ GNU C++ version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) (i386-redhat-linux) compiled by GNU C version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3). host> g++ a.cpp a.cpp: In static member function `static const Key& BePlusTree::NodeList::generate(void*, void*)':a.cpp:114: error: expected primary-expression before ')' token a.cpp:114: error: expected `)' before "item" a.cpp:115: error: expected `)' before ';' token -------- a.cpp --------- #define NULL ((void*)0) typedef long long size_t; // Very fast static array of simple types template class Vector { public: Vector() : count(0) {} T& operator[](int index) { return data[index]; } T* begin() { return data; } T* end() { return data + count; } protected: int count; T data[Capacity]; }; // Template to convert value to index directly template class DefaultKeyValue { public: static const T& generate(void* sender, const T& Item) { return Item; } }; // Template for default value comparsion template class DefaultComparator { public: static bool greaterThan(const T& i1, const T& i2) { return i1 > i2; } }; // Fast sorted array of simple objects // It is used for B+ tree nodes lower, but can still be used by itself template , typename Cmp = DefaultComparator > class SortedVector : public Vector { public: SortedVector() : Vector() {} }; class MallocAllocator { public: void *allocate(size_t size) {return NULL;} void deallocate(void *p) { } }; template , typename Cmp = DefaultComparator, int LeafCount = 100, int NodeCount = 100 > class BePlusTree { public: BePlusTree(Allocator *_pool) : pool(_pool), level(0), defaultAccessor(this) { root = new (_pool->allocate(sizeof(ItemList))) ItemList(); }; ~BePlusTree() { } bool add(const Value& item) { return defaultAccessor.add(item); } private: BePlusTree(Allocator *_pool, void *rootPage) : pool(_pool), level(0), root(new(rootPage) ItemList()), defaultAccessor(this) {} class NodeList; public: class ItemList : public SortedVector { public: NodeList *parent; ItemList *next, *prev; // Adds newly created item to doubly-linked list ItemList(ItemList *items) : parent(NULL) { } ItemList() : parent(NULL), next(NULL), prev(NULL) {}; friend class BePlusTree; friend class BePlusTree::NodeList; }; private: class NodeList : public SortedVector { public: NodeList(NodeList *items) : parent(NULL) {} NodeList() : parent(NULL), next(NULL), prev(NULL) {} int level; NodeList *parent; NodeList *next, *prev; static const Key& generate(void *sender, void *item) { for (int lev = ((NodeList *)sender)->level; lev > 0; lev--) item = *((NodeList *)item)->begin(); return KeyOfValue::generate(item, *((BePlusTree::ItemList *)item)->begin() ); } }; public: class Accessor { public: Accessor(BePlusTree* _tree) : tree(_tree), curr(NULL), curPos(0) {} Value& current() const { return (*curr)[curPos]; } public: BePlusTree* tree; ItemList *curr; int curPos; }; public: Allocator *pool; int level; void *root; Accessor defaultAccessor; friend class MemoryPool; friend class NodeList; friend class Accessor; }; -- Summary: [regression 3.3/3.4.4.0] Product: gcc Version: 3.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kent at sas dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19919