Bug 12346 - cp/decl.c:1178 asserts if class "iterator" defined in a subclass with wrapped multimap
Summary: cp/decl.c:1178 asserts if class "iterator" defined in a subclass with wrappe...
Status: RESOLVED DUPLICATE of bug 5402
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-09-20 01:46 UTC by Ervan Darnell
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ervan Darnell 2003-09-20 01:46:18 UTC
When compiling under g++ 3.3.1 on Solaris or g++ 3.2.2 on x86 Red Hat 7.x
the following program causes g++ to assert as listed in the verbose output. 
Note that naming the inner class "iterator" is critical to producing the
failure.

This message contains:
1) The unpreprocessed source for reference
2) the -v output

This "Description" edit box won't accept the preprocessed output due to length
and the bug description form has no obvious option for attaching source. 
Regardless, it's the standard "map" header distributed with gcc 3.2.2 that is
being used.  Please advise if I can send the preprocessed output some other way.

#include <map>
using namespace std;
struct base {
    class iterator { };
};
struct mymap : public base {
    class map_wrap : public multimap<int, int> 
    { }; 
    class iterator { };
};

Thread model: posix
gcc version 3.2.2
 /import/manx/tools/gcc/dist/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/cpp0 -lang-c++
-D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -iprefix
/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/
-D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102
-D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__
-D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__
-D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386
-D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ t2.cc t2.ii
GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory
"/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/../../../../include/c++/3.2.2"
ignoring nonexistent directory
"/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/../../../../include/c++/3.2.2/i686-pc-linux-gnu"
ignoring nonexistent directory
"/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/../../../../include/c++/3.2.2/backward"
ignoring nonexistent directory
"/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include"
ignoring nonexistent directory
"/home/builder/Shadows/V2.0/linux/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory
"/import/manx/tools/gcc/dist/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /import/manx/tools/gcc/dist/include/c++/3.2.2
 /import/manx/tools/gcc/dist/include/c++/3.2.2/i686-pc-linux-gnu
 /import/manx/tools/gcc/dist/include/c++/3.2.2/backward
 /usr/local/include
 /import/manx/tools/gcc/dist/include
 /import/manx/tools/gcc/dist/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include
 /usr/include
End of search list.
 /import/manx/tools/gcc/dist/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/cc1plus
-fpreprocessed t2.ii -quiet -dumpbase t2.cc -version -o t2.s
GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.2.2 (i686-pc-linux-gnu)
        compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-98).
t2.cc:10: Internal compiler error in pop_binding, at cp/decl.c:1178
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~                                                                                                        
~
Comment 1 Andrew Pinski 2003-09-20 02:06:45 UTC
I can confirm this on the mainline (20030919).
Here is the reduced sources (Do not worry about sending the preprocessed sources):
template <typename>struct ainter {};
template <typename x,typename> struct a
{
  typedef ainter<x> iterator;
};
struct base {
    class iterator { };
};
struct mymap : public base {
    class map_wrap: public a<int,int>
    { };
    class iterator { };
};



This is a dup of bug 5402.

*** This bug has been marked as a duplicate of 5402 ***