public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18733] New: [4.0 Regression] friend rejected
@ 2004-11-30 4:38 pinskia at gcc dot gnu dot org
2004-11-30 4:38 ` [Bug c++/18733] " pinskia at gcc dot gnu dot org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-30 4:38 UTC (permalink / raw)
To: gcc-bugs
I don't know if this is valid code or not, to me this looks like valid code but I could be wrong.
: Search converges between 2004-07-20-trunk (#491) and 2004-07-21-trunk (#492).
This is reduced from PR 15855:
typedef int GVID;
class VG;
template <class T> struct VDifferential
{
typedef T Summary;
Summary summarize(const VG*, GVID, GVID) const;
};
class VG {
friend class VDifferential<char>;
friend VDifferential<char>::Summary VDifferential<char>::summarize(const VG*, GVID, GVID) const;
};
--
Summary: [4.0 Regression] friend rejected
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
@ 2004-11-30 4:38 ` pinskia at gcc dot gnu dot org
2004-11-30 4:51 ` pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-30 4:38 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |giovannibajo at gcc dot gnu
| |dot org, pinskia at gcc dot
| |gnu dot org
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
2004-11-30 4:38 ` [Bug c++/18733] " pinskia at gcc dot gnu dot org
@ 2004-11-30 4:51 ` pinskia at gcc dot gnu dot org
2004-11-30 10:21 ` giovannibajo at libero dot it
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-30 4:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-30 04:51 -------
Comeau C/C++'s online tester accepts this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
2004-11-30 4:38 ` [Bug c++/18733] " pinskia at gcc dot gnu dot org
2004-11-30 4:51 ` pinskia at gcc dot gnu dot org
@ 2004-11-30 10:21 ` giovannibajo at libero dot it
2004-11-30 11:00 ` reichelt at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-30 10:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-11-30 10:21 -------
Confirmed, this is valid code. I have a feeling that this was exposed with one
of my patches on July 21st...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-11-30 10:21:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-30 10:21 ` giovannibajo at libero dot it
@ 2004-11-30 11:00 ` reichelt at gcc dot gnu dot org
2004-12-01 7:11 ` giovannibajo at libero dot it
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-30 11:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-11-30 11:00 -------
More compact testcase:
================================
template<int> struct A
{
void foo();
};
struct B
{
friend void A<0>::foo();
};
================================
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Severity|normal |critical
Keywords| |monitored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-30 11:00 ` reichelt at gcc dot gnu dot org
@ 2004-12-01 7:11 ` giovannibajo at libero dot it
2004-12-01 14:32 ` lerdsuwa at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-01 7:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-01 07:11 -------
Kriang, this looks like a latent bug exposed by my cleanup of template
specialization headers. Since it affects friends, you may want to take a look.
Otherwise, I'll get to it sooner or later.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |lerdsuwa at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-12-01 7:11 ` giovannibajo at libero dot it
@ 2004-12-01 14:32 ` lerdsuwa at gcc dot gnu dot org
2004-12-02 9:28 ` giovannibajo at libero dot it
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-01 14:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-12-01 14:32 -------
The problem is in check_explicit_specialization and/or
current_tmpl_spec_kind functions. They don't handle
specializations in friends correctly.
I still have a few other PRs to deal with and won't get to
this bug until other patches are finished. So feel free to
take it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-12-01 14:32 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-02 9:28 ` giovannibajo at libero dot it
2004-12-02 13:41 ` giovannibajo at libero dot it
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-02 9:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-02 09:28 -------
Right, the whole template header check code is a mess across many files and
executed at different times. This works as a stop-gap:
Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.945
diff -c -3 -p -r1.945 pt.c
*** pt.c 12 Nov 2004 21:47:08 -0000 1.945
--- pt.c 2 Dec 2004 09:25:16 -0000
*************** check_explicit_specialization (tree decl
*** 1739,1745 ****
tree dname = DECL_NAME (decl);
tmpl_spec_kind tsk;
! tsk = current_tmpl_spec_kind (template_count);
switch (tsk)
{
--- 1739,1753 ----
tree dname = DECL_NAME (decl);
tmpl_spec_kind tsk;
! if (is_friend)
! {
! if (!processing_specialization)
! tsk = tsk_none;
! else
! tsk = tsk_excessive_parms;
! }
! else
! tsk = current_tmpl_spec_kind (template_count);
switch (tsk)
{
I'm testing it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-12-02 9:28 ` giovannibajo at libero dot it
@ 2004-12-02 13:41 ` giovannibajo at libero dot it
2004-12-02 13:42 ` giovannibajo at libero dot it
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-02 13:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-02 13:41 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00144.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-12-02 13:41 ` giovannibajo at libero dot it
@ 2004-12-02 13:42 ` giovannibajo at libero dot it
2004-12-17 12:07 ` giovannibajo at libero dot it
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-02 13:42 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC|giovannibajo at gcc dot gnu |
|dot org |
AssignedTo|unassigned at gcc dot gnu |giovannibajo at libero dot
|dot org |it
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2004-12-02 13:42 ` giovannibajo at libero dot it
@ 2004-12-17 12:07 ` giovannibajo at libero dot it
2004-12-17 16:44 ` lerdsuwa at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-17 12:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-17 12:07 -------
Kriang, can you comment on my patch? Does it look correct to you?
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |nathan at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (9 preceding siblings ...)
2004-12-17 12:07 ` giovannibajo at libero dot it
@ 2004-12-17 16:44 ` lerdsuwa at gcc dot gnu dot org
2004-12-17 23:48 ` giovannibajo at libero dot it
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-17 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2004-12-17 16:44 -------
The patch looks correct although the code is messy. With the patch,
when is_friend is true and processing_specialization is false, we
no longer count the number of template header to see if there are
too many - but we've already done that in
cp_parser_check_template_parameters.
The code duplication in cp_parser_check_template_parameters and
current_tmpl_spec_kind could be removed in GCC 4.1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (10 preceding siblings ...)
2004-12-17 16:44 ` lerdsuwa at gcc dot gnu dot org
@ 2004-12-17 23:48 ` giovannibajo at libero dot it
2004-12-23 1:49 ` cvs-commit at gcc dot gnu dot org
2004-12-23 1:50 ` giovannibajo at libero dot it
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-17 23:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-17 23:48 -------
Yes, that's the problem. The whole point is that the parser does not have
enough context information to fully check for the number of template headers:
there is an off-by-one possible error it has to allow. For instance:
template <>
void A<int>::foo(void);
The correctness of this depends on whether A<int> uses an explicit
specialization or not. So yes, we could unify this for 4.1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (11 preceding siblings ...)
2004-12-17 23:48 ` giovannibajo at libero dot it
@ 2004-12-23 1:49 ` cvs-commit at gcc dot gnu dot org
2004-12-23 1:50 ` giovannibajo at libero dot it
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-23 1:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-12-23 01:49 -------
Subject: Bug 18733
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: giovannibajo@gcc.gnu.org 2004-12-23 01:49:39
Modified files:
gcc/cp : ChangeLog pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: friend33.C
Log message:
PR c++/18733
* pt.c (check_explicit_specialization): Use special logic to validate
befriended specializations.
PR c++/18733
* g++.dg/template/friend33.C: New testcase.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4553&r2=1.4554
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.959&r2=1.960
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4800&r2=1.4801
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend33.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/18733] [4.0 Regression] friend rejected
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
` (12 preceding siblings ...)
2004-12-23 1:49 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-23 1:50 ` giovannibajo at libero dot it
13 siblings, 0 replies; 15+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-23 1:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-23 01:50 -------
Fixed in GCC 4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18733
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2004-12-23 1:50 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-30 4:38 [Bug c++/18733] New: [4.0 Regression] friend rejected pinskia at gcc dot gnu dot org
2004-11-30 4:38 ` [Bug c++/18733] " pinskia at gcc dot gnu dot org
2004-11-30 4:51 ` pinskia at gcc dot gnu dot org
2004-11-30 10:21 ` giovannibajo at libero dot it
2004-11-30 11:00 ` reichelt at gcc dot gnu dot org
2004-12-01 7:11 ` giovannibajo at libero dot it
2004-12-01 14:32 ` lerdsuwa at gcc dot gnu dot org
2004-12-02 9:28 ` giovannibajo at libero dot it
2004-12-02 13:41 ` giovannibajo at libero dot it
2004-12-02 13:42 ` giovannibajo at libero dot it
2004-12-17 12:07 ` giovannibajo at libero dot it
2004-12-17 16:44 ` lerdsuwa at gcc dot gnu dot org
2004-12-17 23:48 ` giovannibajo at libero dot it
2004-12-23 1:49 ` cvs-commit at gcc dot gnu dot org
2004-12-23 1:50 ` giovannibajo at libero dot it
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).