This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8570: line number in error message is badly placed with illegal template friend declaration


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]