This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8163: call of template code is rejected as private in this context
- From: schnoerr at mailzone dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Oct 2002 16:52:42 -0000
- Subject: c++/8163: call of template code is rejected as private in this context
- Reply-to: schnoerr at mailzone dot com
>Number: 8163
>Category: c++
>Synopsis: call of template code is rejected as private in this context
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Oct 07 09:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Claudius Schnörr
>Release: gcc version 3.2 20020818 (prerelease)
>Organization:
>Environment:
Configured with: /netrel/src/gcc-3.2-1/configure --enable-languages=c,c++,f77,ja
va --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --with
out-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc
-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr
--sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecd
ir=/usr/sbin
Thread model: posix
gcc version 3.2 20020818 (prerelease)
>Description:
A method Test<Type,1>::testfkt() is called.
Therein, a method Test<Type,2>::dat_embrace( Test<Type,1> & )
of a local Test<Type,2>-objekt is called, which is rejected as
being private to TopObj<Type,1>.
This is true but in this case, a local TopObj<Type,2> calls it,
which should be allowed to call it.
I think this is incorrect, but I'm not sure.
The error message:
g++ test.cc -o test -Wall
test.cc: In member function `Test<Rank>& Test<Rank>::testfkt() [with short int
Rank = 1]':
test.cc:24: instantiated from here
test.cc:13: `void Test<Rank>::dat_embrace(Test<LowRank>&) [with short int
LowRank = 1, short int Rank = 2]' is private
test.cc:19: within this context
>How-To-Repeat:
>Fix:
Work around:
make corresponding methods public:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cc"
dGVtcGxhdGUgPHNob3J0IFJhbms+CmNsYXNzIFRlc3QgewpwdWJsaWM6CiAgICBUZXN0KCkge30K
CiAgICBUZXN0PFJhbms+ICYgdGVzdGZrdCgpOwpwcml2YXRlOgogICAgdGVtcGxhdGUgPHNob3J0
IExvd1Jhbms+CiAgICBpbmxpbmUgdm9pZCBkYXRfZW1icmFjZSggVGVzdDxMb3dSYW5rPiAmIGRh
ZCApOwp9OwoKdGVtcGxhdGUgPHNob3J0IFJhbms+IHRlbXBsYXRlIDxzaG9ydCBMb3dSYW5rPgp2
b2lkIFRlc3Q8UmFuaz46OmRhdF9lbWJyYWNlKCBUZXN0PExvd1Jhbms+ICYgdHR0ICkge30KCnRl
bXBsYXRlIDxzaG9ydCBSYW5rPgpUZXN0PFJhbms+ICYgVGVzdDxSYW5rPjo6dGVzdGZrdCgpIHsK
ICAgIFRlc3Q8Mj4gdG8yID0gVGVzdDwyPigpOwogICAgVGVzdDwxPiB0bzEgPSBUZXN0PDE+KCk7
CiAgICB0bzIuZGF0X2VtYnJhY2UoIHRvMSApOwp9CgppbnQgbWFpbiAoKSB7CiAgICBUZXN0PDE+
IHR0dCA9IFRlc3Q8MT4oKTsKICAgIHR0dC50ZXN0Zmt0KCk7Cn0K