This is the mail archive of the gcc-bugs@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: template map value_type bug


On Thu, 18 May 2000, Martin v. Loewis wrote:

> > 	because "value_type" is not recognized as a type even though
> > 	"key_type" is.  A declaration of C without using any templates
> > 	at all compiles correctly.
> 
> Thanks for your bug report. This is not a bug in the compiler, but in
> your code. Compile with -pedantic to see that this is a g++ extension
> which only applies to key_type, as value_type is also known globally.
> Use typename to correct this code.

	OK, I do this:

		#include <map>

		template< class T > class C : std::map< char const*, T > {
			typedef std::map< char const*, T > map_type;
			typedef map_type::value_type value_type;

			void insert( value_type const & ); // line 7
		};

	and get:

$ g++ -c bug.c
bug.c:7: Internal compiler error 61.
bug.c:7: Please submit a full bug report.
bug.c:7: Internal compiler error:
bug.c:7: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

	- Paul


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