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]
Other format: [Raw text]

c++/9801: [3.4 regression] new parser: confusing error message for missing typename


>Number:         9801
>Category:       c++
>Synopsis:       [3.4 regression] new parser: confusing error message for missing typename
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 22 08:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.4 20030221 (experimental)
>Organization:
>Environment:
System: FreeBSD acrux.dbai.tuwien.ac.at 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Thu Jan 9 09:25:29 CET 2003 root at aludra dot dbai dot tuwien dot ac dot at:/usr/src/sys/compile/DBAI-MP i386


	
host: i386-unknown-freebsd4.7
build: i386-unknown-freebsd4.7
target: i386-unknown-freebsd4.7
configured with: /sw/test/gcc/cvs/configure --prefix=/sw/gcc-current --enable-languages=c,c++ --disable-checking
>Description:
	Given the following program (which lacks typename in line 12)

#include <vector>

using namespace std;

template <class T>
class TCONJUNCTION
    {
    typedef int iterator;
public:
    void get()
        {
        for( /*typename*/ TCONJUNCTION<T>::iterator i = 1; // line 12
             i != 10;
             i++ )
            { }
        }
    };

	the new parser issues the following hard error:

	  x.cc: In member function `void TCONJUNCTION<T>::get()':
	  x.cc:12: error: expected `;'
  	  x.cc:13: error: `i' has not been declared
	  x.cc:14: error: `i' has not been declared

	This is correct per se, but confusing for the average user,
	especially as previous versions of GCC did _not_ issue the
	"implicit typename" warning, or any warning for that matter,
	even with -ansi -pedantic -W -Wall.

>How-To-Repeat:
	Save program as x.cc and `g++ x.cc`.
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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