From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25860 invoked by alias); 16 Jan 2008 15:34:05 -0000 Received: (qmail 25851 invoked by uid 22791); 16 Jan 2008 15:34:04 -0000 X-Spam-Check-By: sourceware.org Received: from 92.44.227.87.static.f.siw.siwnet.net (HELO localhost.localdomain) (87.227.44.92) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 16 Jan 2008 15:33:42 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id D303552F98E for ; Wed, 16 Jan 2008 16:36:06 +0100 (CET) Message-ID: <478E2466.9010506@home.se> Date: Thu, 17 Jan 2008 08:58:00 -0000 From: Erik User-Agent: Thunderbird 2.0.0.9 (X11/20071124) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Can not declare std::map::iterator in template (error: expected `;' before "my_A_iterator") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00147.txt.bz2 I have the strange problem that I can not declare a std::map::iterator inside a template: #include template struct A {}; template struct B { typedef A G; void f(G const & a) { std::map my_As; std::map::iterator my_A_iterator = my_As.find(&a); } }; The compiler says «error: expected `;' before "my_A_iterator"». If I change A to for example bool, it compiles. What could possibly be wrong? I tried both g++-4.2.1 and g++-4.2.2.