public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class
@ 2003-12-01 17:03 fmonica at ce dot unipr dot it
2003-12-01 20:57 ` [Bug c++/13262] [3.3/3.4 regression] " bangerth at dealii dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: fmonica at ce dot unipr dot it @ 2003-12-01 17:03 UTC (permalink / raw)
To: gcc-bugs
This code will compile successful with gcc <= 3.2.3 but doesn't work with gcc
3.3.1 or 3.3.2:
-----------------------------------------------------
template < typename T >
class Aclass
{
private:
Aclass() {}
static Aclass instance;
};
template < typename T > Aclass<T> Aclass<T>::instance;
template class Aclass<int>;
-----------------------------------------------------
The gcc compiler emits an error like this:
test.cc: In instantiation of `Aclass<int> Aclass<int>::instance':
test.cc:12: instantiated from here
test.cc:5: error: `Aclass<T>::Aclass() [with T = int]' is private
test.cc:9: error: within this context
This code also works if an explicit instantiation of "instance" is added
before the last line:
Aclass<int> Aclass<int>::instance;
That strategy (self contained class with private ctor) will be useful to build
pattern like "Singleton", proposed by GoF. Of course there are some other ways
to do this :-)
I'm in doublt, but I think the code should be correct...
--
Summary: "xxx is private within this context" when initializing a
*self-contained* template class
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fmonica at ce dot unipr dot it
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
@ 2003-12-01 20:57 ` bangerth at dealii dot org
2003-12-02 0:45 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-12-01 20:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2003-12-01 20:57 -------
Confirmed. Kriang, you are the friendship expert: I am not quite sure
what the standard says, but the present behavior doesn't really
make much sense. What do you think?
W.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |lerdsuwa at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-12-01 20:57:21
date| |
Summary|"xxx is private within this |[3.3/3.4 regression] "xxx is
|context" when initializing a|private within this context"
|*self-contained* template |when initializing a *self-
|class |contained* template class
Target Milestone|--- |3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
2003-12-01 20:57 ` [Bug c++/13262] [3.3/3.4 regression] " bangerth at dealii dot org
@ 2003-12-02 0:45 ` pinskia at gcc dot gnu dot org
2003-12-02 0:51 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-02 0:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-02 00:45 -------
>From Phil's regression hunter: Search converges between 2003-05-15-trunk (#296) and 2003-05
-29-trunk (#297).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
2003-12-01 20:57 ` [Bug c++/13262] [3.3/3.4 regression] " bangerth at dealii dot org
2003-12-02 0:45 ` pinskia at gcc dot gnu dot org
@ 2003-12-02 0:51 ` pinskia at gcc dot gnu dot org
2003-12-05 12:09 ` lerdsuwa at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-02 0:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-02 00:51 -------
I should say that date that I just referenced is for the mainline being broken again (it was fixed at
one point between the time 3.3 branched and that date: Search converges between 2003-02-25-
trunk (#231) and 2003-02-26-trunk (#232).).
It also was broken before the branch: Search converges between 2002-10-11-trunk (#101) and
2002-10-12-trunk (#102).
It was never fixed on the 3.3 branch though.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Target Milestone|3.4 |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
` (2 preceding siblings ...)
2003-12-02 0:51 ` pinskia at gcc dot gnu dot org
@ 2003-12-05 12:09 ` lerdsuwa at gcc dot gnu dot org
2003-12-15 12:23 ` lerdsuwa at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-12-05 12:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-12-05 12:09 -------
Yup, this should compile. Somewhere in deferred access checking code is broken.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |lerdsuwa at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
` (3 preceding siblings ...)
2003-12-05 12:09 ` lerdsuwa at gcc dot gnu dot org
@ 2003-12-15 12:23 ` lerdsuwa at gcc dot gnu dot org
2003-12-18 14:51 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-12-15 12:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-12-15 12:23 -------
Patch waiting for approval for 3.4 version:
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01198.html
and 3.3.3:
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01199.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
` (4 preceding siblings ...)
2003-12-15 12:23 ` lerdsuwa at gcc dot gnu dot org
@ 2003-12-18 14:51 ` cvs-commit at gcc dot gnu dot org
2003-12-18 15:26 ` cvs-commit at gcc dot gnu dot org
2003-12-18 15:53 ` lerdsuwa at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-18 14:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-12-18 14:14 -------
Subject: Bug 13262
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: lerdsuwa@gcc.gnu.org 2003-12-18 14:14:48
Modified files:
gcc/cp : ChangeLog pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: access13.C
Log message:
PR c++/13262
* pt.c (instantiate_decl): Wrap push_nested_class and
pop_nested_class around cp_finish_decl call for static member
variable.
* g++.dg/template/access13.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3818&r2=1.3819
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.803&r2=1.804
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3280&r2=1.3281
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/access13.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
` (5 preceding siblings ...)
2003-12-18 14:51 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-18 15:26 ` cvs-commit at gcc dot gnu dot org
2003-12-18 15:53 ` lerdsuwa at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-18 15:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-12-18 14:27 -------
Subject: Bug 13262
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: lerdsuwa@gcc.gnu.org 2003-12-18 14:27:49
Modified files:
gcc/cp : ChangeLog pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: access13.C
Log message:
PR c++/13262
* pt.c (instantiate_decl): Wrap push_nested_class and
pop_nested_class around cp_finish_decl call for static member
variable.
* g++.dg/template/access13.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.222&r2=1.3076.2.223
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.635.2.38&r2=1.635.2.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.337&r2=1.2261.2.338
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/access13.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/13262] [3.3/3.4 regression] "xxx is private within this context" when initializing a *self-contained* template class
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
` (6 preceding siblings ...)
2003-12-18 15:26 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-18 15:53 ` lerdsuwa at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2003-12-18 15:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-12-18 14:31 -------
Fixed in 3.3 and 3.4 branches.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13262
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-12-18 14:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-01 17:03 [Bug c++/13262] New: "xxx is private within this context" when initializing a *self-contained* template class fmonica at ce dot unipr dot it
2003-12-01 20:57 ` [Bug c++/13262] [3.3/3.4 regression] " bangerth at dealii dot org
2003-12-02 0:45 ` pinskia at gcc dot gnu dot org
2003-12-02 0:51 ` pinskia at gcc dot gnu dot org
2003-12-05 12:09 ` lerdsuwa at gcc dot gnu dot org
2003-12-15 12:23 ` lerdsuwa at gcc dot gnu dot org
2003-12-18 14:51 ` cvs-commit at gcc dot gnu dot org
2003-12-18 15:26 ` cvs-commit at gcc dot gnu dot org
2003-12-18 15:53 ` lerdsuwa 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).