public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6649: implicit typename warning suggests action that leads to a syntax error
@ 2002-05-13  9:46 gianni
  0 siblings, 0 replies; 2+ messages in thread
From: gianni @ 2002-05-13  9:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6649
>Category:       c++
>Synopsis:       implicit typename warning suggests action that leads to a syntax error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 13 09:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gianni Mariani
>Release:        gcc 3.1 pre release
>Organization:
>Environment:
Red Hat 7.2
>Description:
If I follow the suggestions from the compiler and place a 'typename' in the given place ( see where the TYPENAME_SYNTAX_ERROR macro expands) the gcc 3.1 compiler complains that it's a syntax error to do so. The code below is demonstrates this - uncomment the 'typename' keyword from the macro to demonstrate the compiler's syntax error report or leave it commented and experience a warning.


#============= snip =======================

#include <list>

template< class client_base, class service_base>
class TMPL_A;

template< class client_base, class service_base>
class TMPL_B;

template< class client_base, class service_base>
class TMPL_C {
 public:

   typedef TMPL_A< client_base,service_base> * t_elem_type;

   typedef std::list< t_elem_type >            t_x_list;

   typedef typename t_x_list::iterator         t_x_iter;

   typedef typename std::list< t_x_iter >      t_x_iter_list;

   typedef typename t_x_iter_list::iterator    t_x_iter_iter;

};


// ======== TMPL_A ===============================
/**
*  TMPL_A is a template for Service handler for
*  a client.
*  */

template< class client_base, class service_base>
class TMPL_A
 : public client_base,
   public TMPL_C<client_base,service_base>
{
public:

#define TYPENAME_SYNTAX_ERROR //typename

// define some members

   TYPENAME_SYNTAX_ERROR t_x_iter            m_my_iter;

   TMPL_B<client_base,service_base>        * m_my_service;

   // some more stuff goes here

};

>How-To-Repeat:

Take the code in the description and compile it with gcc 3.1PR with warning turned on. The compiler will warn about implicit typename use being depricated, adding typename (by removing the // in from of typename in the #define) yields a syntax error.

This is a violation of the Gianni rule for compilers :
A compiler must not generate a warning that will lead to worse errors.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/6649: implicit typename warning suggests action that leads to a syntax error
@ 2002-05-26  7:50 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-05-26  7:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gianni, nobody

Synopsis: implicit typename warning suggests action that leads to a syntax error

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Sun May 26 07:47:04 2002
State-Changed-Why:
    Not a bug.  What the compiler actually suggest you is the following code:
       typename TMPL_C<client_base,service_base>::t_x_iter            m_my_iter;

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6649


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-26 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-13  9:46 c++/6649: implicit typename warning suggests action that leads to a syntax error gianni
2002-05-26  7:50 lerdsuwa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).