public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gianni@mariani.ws
To: gcc-gnats@gcc.gnu.org
Subject: c++/6649: implicit typename warning suggests action that leads to a syntax error
Date: Mon, 13 May 2002 09:46:00 -0000	[thread overview]
Message-ID: <20020513164232.17978.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-05-13 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-13  9:46 gianni [this message]
2002-05-26  7:50 lerdsuwa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020513164232.17978.qmail@sources.redhat.com \
    --to=gianni@mariani.ws \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).