public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: khlebnikov@scnsoft.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/3496: template parm shadow reporting when it is not
Date: Sat, 30 Jun 2001 05:16:00 -0000	[thread overview]
Message-ID: <20010630121432.14387.qmail@sourceware.cygnus.com> (raw)

>Number:         3496
>Category:       c++
>Synopsis:       template parm shadow reporting when it is not
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 30 05:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     g++
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Kernel 2.4.5, glibc 2.1, i686
>Description:
I want to access a template class ttype parameter outside the class.
Code example:

//////// begin /////////

template <class T> class C {
 
public:
    typedef T T;
    T v;
};
 
//void main () {
//
//      typedef C <int> CC;
//      CC::T i;
//}                           

////////////// end ////////////////////

gcc reports:
$g++ -c error.cpp
error.cpp:4: declaration of `typedef T C<T>::T'
error.cpp:1:  shadows template parm `class T'
error.cpp:4: declaration of `typedef T C<T>::T'
error.cpp:1: changes meaning of `T' from `class T'   

So, type T is "shadowed" by type T. I think, this is not an error
in code, but a compiler bug.
MS Visual C++ compiles this OK.

Detailed out:
$g++ -v -save-temps -c error.cpp
>How-To-Repeat:
g++ -c error.cpp
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="error.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="error.ii"

IyAxICJlcnJvci5jcHAiCnRlbXBsYXRlIDxjbGFzcyBUPiBjbGFzcyBDIHsKCnB1YmxpYzoKCXR5
cGVkZWYgVCBUOwogICAgVCB2Owp9OwoKIAogCiAKIAogCg==


             reply	other threads:[~2001-06-30  5:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-30  5:16 khlebnikov [this message]
2001-08-12  3:38 gdr

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=20010630121432.14387.qmail@sourceware.cygnus.com \
    --to=khlebnikov@scnsoft.com \
    --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).