public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14930] New: Friend declaration ignored
@ 2004-04-13  0:02 austern at apple dot com
  2004-04-13  0:30 ` [Bug c++/14930] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: austern at apple dot com @ 2004-04-13  0:02 UTC (permalink / raw)
  To: gcc-bugs

Here's the code sample:
template<typename T> class Point;

template<> class Point<double> {
  friend class Plane;
  double v;
};

struct Plane {
  double get(const Point<double>& p);
};

double Plane::get(const Point<double> &p) { return p.v; }

Compiling this gives an error message:
foo.cc: In member function `double Plane::get(constPoint<double>&)':
foo.cc:7: error: `double Point<double>::v' is private
foo.cc:14: error: within this context

I can't find any justification for this error.  The only odd thing about this code sample is that the friend 
declaration is the first time we have encountered the name "Plane", but this is legal.  It even appears in 
one of the examples in clause 11.4 of the standard.

Note that this error is very delicate.  It goes away in the non-template case and it goes away if we use 
an impliict instantiation instead of an explicit specialization.

-- 
           Summary: Friend declaration ignored
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: austern at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.3.0
  GCC host triplet: powerpc-apple-darwin7.3.0
GCC target triplet: powerpc-apple-darwin7.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
@ 2004-04-13  0:30 ` pinskia at gcc dot gnu dot org
  2004-04-15 22:50 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-13  0:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-12 23:12 -------
Confirmed, a regression from 2.95.3, looks related to PR 4403.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.0.4 3.2.3 3.3.1 3.3.3
                   |                            |3.4.0 3.5.0
      Known to work|                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-12 23:12:39
               date|                            |
            Summary|Friend declaration ignored  |[3.3/3.4/3.5 Regression]
                   |                            |Friend declaration ignored
   Target Milestone|---                         |3.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
  2004-04-13  0:30 ` [Bug c++/14930] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-04-15 22:50 ` reichelt at gcc dot gnu dot org
  2004-06-06  3:38 ` giovannibajo at libero dot it
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-04-15 22:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |critical
  GCC build triplet|powerpc-apple-darwin7.3.0   |
   GCC host triplet|powerpc-apple-darwin7.3.0   |
 GCC target triplet|powerpc-apple-darwin7.3.0   |
           Keywords|                            |monitored


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
  2004-04-13  0:30 ` [Bug c++/14930] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-04-15 22:50 ` reichelt at gcc dot gnu dot org
@ 2004-06-06  3:38 ` giovannibajo at libero dot it
  2004-06-12 21:47 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-06-06  3:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-06-06 03:38 -------
Retargeting to 3.4.1, being a regression on that release branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at gcc dot gnu dot org
   Target Milestone|3.3.4                       |3.4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
                   ` (2 preceding siblings ...)
  2004-06-06  3:38 ` giovannibajo at libero dot it
@ 2004-06-12 21:47 ` mmitchel at gcc dot gnu dot org
  2004-06-14 15:53 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-06-12 21:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-06-12 21:47 -------
Working on a fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
                   ` (3 preceding siblings ...)
  2004-06-12 21:47 ` mmitchel at gcc dot gnu dot org
@ 2004-06-14 15:53 ` cvs-commit at gcc dot gnu dot org
  2004-06-14 15:59 ` cvs-commit at gcc dot gnu dot org
  2004-06-14 17:14 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-14 15:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-06-14 15:52 -------
Subject: Bug 14930

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-06-14 15:52:50

Modified files:
	gcc/cp         : decl.c name-lookup.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: friend30.C ptrmem10.C 

Log message:
	PR c++/15096
	* decl.c (grokdeclarator): Ignore pointer-to-members when
	computing template depth.
	
	PR c++/14930
	* name-lookup.c (pushtag): Do not try to put class declarations in
	explicit specialization scopes.
	
	PR c++/15096
	* g++.dg/template/ptrmem10.C: New test.
	
	PR c++/14930
	* g++.dg/template/friend30.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.20&r2=1.1174.2.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.15&r2=1.34.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.122&r2=1.3892.2.123
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.206&r2=1.3389.2.207
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend30.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem10.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
                   ` (4 preceding siblings ...)
  2004-06-14 15:53 ` cvs-commit at gcc dot gnu dot org
@ 2004-06-14 15:59 ` cvs-commit at gcc dot gnu dot org
  2004-06-14 17:14 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-14 15:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-06-14 15:58 -------
Subject: Bug 14930

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-06-14 15:58:54

Modified files:
	gcc/cp         : decl.c name-lookup.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: friend30.C ptrmem10.C 

Log message:
	PR c++/15096
	* decl.c (grokdeclarator): Ignore pointer-to-members when
	computing template depth.
	
	PR c++/14930
	* name-lookup.c (pushtag): Do not try to put class declarations in
	explicit specialization scopes.
	
	PR c++/15096
	* g++.dg/template/ptrmem10.C: New test.
	
	PR c++/14930
	* g++.dg/template/friend30.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1214&r2=1.1215
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.58&r2=1.59
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4094&r2=1.4095
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3854&r2=1.3855
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend30.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem10.C.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/14930] [3.3/3.4/3.5 Regression] Friend declaration ignored
  2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
                   ` (5 preceding siblings ...)
  2004-06-14 15:59 ` cvs-commit at gcc dot gnu dot org
@ 2004-06-14 17:14 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-06-14 17:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-06-14 17:14 -------
Fixed in GCC 3.4.1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14930


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-06-14 17:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13  0:02 [Bug c++/14930] New: Friend declaration ignored austern at apple dot com
2004-04-13  0:30 ` [Bug c++/14930] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-04-15 22:50 ` reichelt at gcc dot gnu dot org
2004-06-06  3:38 ` giovannibajo at libero dot it
2004-06-12 21:47 ` mmitchel at gcc dot gnu dot org
2004-06-14 15:53 ` cvs-commit at gcc dot gnu dot org
2004-06-14 15:59 ` cvs-commit at gcc dot gnu dot org
2004-06-14 17:14 ` mmitchel at gcc dot gnu dot org

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).