public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bangerth@ticam.utexas.edu
To: gcc-gnats@gcc.gnu.org
Subject: c++/9252: [3.4 regression][New parser] Errors due to legally used "typename"
Date: Thu, 09 Jan 2003 19:16:00 -0000	[thread overview]
Message-ID: <20030109191422.1843.qmail@sources.redhat.com> (raw)


>Number:         9252
>Category:       c++
>Synopsis:       [3.4 regression][New parser] Errors due to legally used "typename"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 09 11:16:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
3.4 since new parser merge
>Description:
This code
---------------------------
class O {
    struct I { I (int); };

    template <class T_>
    friend typename O::I f ();
};

template <class T_>
typename O::I f () { return 1; };

struct X {
    void g() { f<int>(); }
};
----------------------------------
used to compile until 3.3, but with the new parser I get
tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc
x.cc:2: error: `struct O::I' is private
x.cc:9: error: within this context
x.cc:2: error: `struct O::I' is private
x.cc:9: error: within this context

The message is clearly wrong, and furthermore goes away
if the "typename" is removed in the two places where it is
not necessary! Weird, and not very helpful to find the
real cause of the problem.

On the other hand, Gaby pointed out the right place in the
standard that seems to indicate the validity of the use
of "typename" here:
| > 14.6/5:
| >
| >   The keyword typename shall only be used in template declarations and
| >   definitions, including in the return type of a function template or
| >   member function template, in the return type for the definition of a
| >   member function of a class template or of a class nested within a
| >   class template, and in the type-specifier for the def-inition of a
| >   static member of a class template or of a class nested within a
| >   class template. The keyword typename shall only be applied to
| >   qualified names, but *those names need not be dependent*. [...]

>How-To-Repeat:

>Fix:

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


             reply	other threads:[~2003-01-09 19:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-09 19:16 bangerth [this message]
2003-01-10 13:55 lerdsuwa
2003-01-20 11:36 Kriang Lerdsuwanakij
2003-04-15 10:56 Kriang Lerdsuwanakij
2003-05-10 12:17 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=20030109191422.1843.qmail@sources.redhat.com \
    --to=bangerth@ticam.utexas.edu \
    --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).