public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrey Slepuhin <pooh@msu.ru>
To: gcc@gcc.gnu.org
Subject: Re: [gcc-3.0 bug?] C++ symbols treated as C
Date: Tue, 24 Apr 2001 03:29:00 -0000	[thread overview]
Message-ID: <20010424142909.B1853@glade.nmd.msu.ru> (raw)
In-Reply-To: <20010423093415.H4326@glade.nmd.msu.ru>

On Mon, Apr 23, 2001 at 09:34:15AM +0400, Andrey Slepuhin wrote:
> Hi,
> 
> Trying to upgrade from 20010311 to 20010419 gcc snapshot
> (taken from CodeSourcery) I got undefined references
> when linking my C++ code. Looking into assembler output I see the
> things like following:

[snip]

Ok, I found a test case which localizes a problem.
Compiling the following program with 20010422 snapshot:

-------------------------------------------------------
#include <cstdio>

namespace A
{

int abcdef;

template <typename val_t>
class X
{
public:
  inline X ()
  {
    extern int abcdef;
    printf("%d\n", abcdef);
  }
};

}

using namespace A;

int main (int argc, char* argv[])
{
  X<int> x;
  return 0;
}
------------------------------------------------------------

I got the following error:
/tmp/ccWmhmdS.o: In function `A::X<int>::X()':
/tmp/ccWmhmdS.o(.gnu.linkonce.t._ZN1A1XIiEC1Ev+0xb): undefined reference to
`abcdef'
collect2: ld returned 1 exit status

Assembler output shows that "extern int abcdef;" is not considered as a member
of namespace A. 20010311 snapshot compiles this program without errors.
Making X non-template class also removes errors.

Regards,
Andrey.

-- 
A right thing should be simple (tm)

      reply	other threads:[~2001-04-24  3:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-22 22:34 Andrey Slepuhin
2001-04-24  3:29 ` Andrey Slepuhin [this message]

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=20010424142909.B1853@glade.nmd.msu.ru \
    --to=pooh@msu.ru \
    --cc=gcc@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).