Reported by Ole Laursen here: http://gcc.gnu.org/ml/gcc/2003-05/msg01686.html --------------------------------------------- class X { private: template <typename T> struct Y; }; template <> struct X::Y<int> {}; --------------------------------------------- gccbug5.cpp:4: error: `template<class T> struct X::Y' is private gccbug5.cpp:9: error: within this context Regression on the 3.3 branch and mainline (3.2.2 and 2.95 worked fine). Release: 3.3 and 3.4 (CVS 20030503) Environment: i686-pc-cygwin How-To-Repeat: Compile the above snippet
Responsible-Changed-From-To: unassigned->lerdsuwa Responsible-Changed-Why: Kriang said that he will take care of this.
State-Changed-From-To: open->analyzed State-Changed-Why: Already analyzed by Gaby and Kriang, and reconfirmed by me.
Patch submitted: http://gcc.gnu.org/ml/gcc-patches/2003-05/msg02152.html
*** Bug 10969 has been marked as a duplicate of this bug. ***
Fixed in the 3.3 branch.
[forwarded from http://bugs.debian.org/193830] fyi, gcc version 3.3.1 20030626 (Debian prerelease) (aka '3.3.1-0pre0' in debian) improves a bit on the situation: class Foo { template <class T> struct InFoo; template <class T, class U> struct InFoo2; }; template<> struct Foo::InFoo<int> { // ...this works now... (didn't work with 3.3.0) }; template<class T> struct Foo::InFoo2<T, int> { // ...this still triggers error };
Confirmed. Kriang, your 3.3 workaround is not complete because processing_specialization is set only for explicit specializations, not for partial specializations.
Look like it needs a real fix, not just my workaround.
Patch submitted: http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00693.html
Subject: Bug 10849 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: lerdsuwa@gcc.gnu.org 2003-07-10 12:43:17 Modified files: gcc/cp : ChangeLog cp-tree.h decl2.c parse.y search.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: access12.C Log message: PR c++/10849 * decl2.c (handle_class_head_apparent_template): New function. * cp-tree.h (handle_class_head_apparent_template): Add declaration. * parse.y (class_head_defn): Use it. * search.c (type_access_control): Revert my 2003-05-25 change. * g++.dg/template/access12.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.176&r2=1.3076.2.177 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.776.2.24&r2=1.776.2.25 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.575.2.33&r2=1.575.2.34 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.284.2.6&r2=1.284.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.243.2.12&r2=1.243.2.13 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.223&r2=1.2261.2.224 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/access12.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 10849 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2003-07-10 12:48:17 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: access12.C Log message: PR c++/10849 * g++.dg/template/access12.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2857&r2=1.2858 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/access12.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Fixed.