public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: marc@mit.edu
To: gcc-gnats@gcc.gnu.org
Subject: c++/8050: g++ instantiates template too late
Date: Wed, 25 Sep 2002 16:16:00 -0000	[thread overview]
Message-ID: <20020925231229.29060.qmail@sources.redhat.com> (raw)


>Number:         8050
>Category:       c++
>Synopsis:       g++ instantiates template too late
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 16:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Marc Horowitz
>Release:        unknown-1.0
>Organization:
>Environment:
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
>Description:
g++ gives an error on valid code.  I believe the problem
has to do with when templates are instantiated and available
to the compiler, but it is difficult to be certain.

I first observed this with the compiler listed in the
Environment field above, but have confirmed it exists
in 3.0.3 and 3.1.  It does not exist in 2.95.3 or 2.95.4.
I do not have access to 3.2, or any snapshots.
>How-To-Repeat:
Compile this code:

template <class T>
class X
{
public:
    operator T*() { return(0); }
};

int* p;
extern X<int> xp;

void foo()
{

    p == xp;
    xp == p;

    p == xp;
}

with this command line:

g++ -c foo.cc

You will get this error:

cfp.cc: In function `void foo ()':
cfp.cc:14: no match for `int *& == X<int> &'

If you reorder the lines in foo() so that line 15 is first,
the compiler does not complain anymore.
>Fix:
Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-09-25 23:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25 16:16 marc [this message]
2002-09-25 16:46 Andrew Pinski
2002-09-25 19:56 Marc Horowitz
2002-09-25 19:56 Marc Horowitz
2002-09-30 10:42 nathan
2003-04-15 20:46 florian.kirsch
2003-04-15 21:33 steven

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=20020925231229.29060.qmail@sources.redhat.com \
    --to=marc@mit.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).