template map value_type bug

Paul J. Lucas pjl@barefooters.org
Wed May 17 16:56:00 GMT 2000


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



More information about the Gcc-bugs mailing list