public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: llib@computer.org
To: gcc-gnats@gcc.gnu.org
Subject: c++/8570: line number in error message is badly placed with illegal template friend declaration
Date: Wed, 20 Nov 2002 07:00:00 -0000	[thread overview]
Message-ID: <200211140450.PAA12993@alto.anu.edu.au> (raw)


>Number:         8570
>Category:       c++
>Synopsis:       line number in error message is badly placed with illegal template friend declaration
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 13 20:56:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bill Clarke
>Release:        3.2
>Organization:
>Environment:
System: SunOS alto 5.9 Generic sun4u sparc SUNW,Sun-Blade-1000
Architecture: sun4
host: sparc-sun-solaris2.9
build: sparc-sun-solaris2.9
target: sparc-sun-solaris2.9
configured with: ../gcc-3.2/configure --prefix=/space/bill/util --with-cpu=ultrasparc --enable-languages=c,c++,f77
>Description:
The line number in an error message with illegal is badly placed, nowhere
near the offending friend declaration.

>How-To-Repeat:
With this file:
// templ-friend-bug.cc
template <typename T, typename P>
class X {
public:
  X() { }

private:
  template <typename U> friend class X;
};

X<int, int> i;
// end

compiling with g++ 3.2 gives the following message:
? g++ -c templ-friend-bug.cc 
templ-friend-bug.cc: In instantiation of `X<int, int>':
templ-friend-bug.cc:11:   instantiated from here
templ-friend-bug.cc:3: previous declaration `template<class T, class P> class X'
templ-friend-bug.cc:3: used 2 template parameters instead of 1
?

the same occurs with 3.2.1 pre (20021110) and 3.3 pre (20021110)

it would be nice if it mentioned line 8 somewhere in the error message
(presumably the last line).  it took a great deal of time to find the
problem in my code with a rather large template.

my original code also got an ICE in 3.3 pre, but this stripped down version
didn't.  i'll look into that separately.
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-11-14  4:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-20  7:00 llib [this message]
2002-11-20 18:01 bangerth

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=200211140450.PAA12993@alto.anu.edu.au \
    --to=llib@computer.org \
    --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).