public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21644] New: protected members of templated base class not accessible in derived class
@ 2005-05-18 12:36 tonne2005 at gehheimdienst dot de
2005-05-18 12:37 ` [Bug c++/21644] " tonne2005 at gehheimdienst dot de
0 siblings, 1 reply; 2+ messages in thread
From: tonne2005 at gehheimdienst dot de @ 2005-05-18 12:36 UTC (permalink / raw)
To: gcc-bugs
See the following code example:
#include <iostream>
template <typename tn>
class a{
protected:
tn bar;
public:
a(tn bar){
this->bar=bar;
}
virtual tn getBar(){
return bar;
}
};
template <typename tn>
class b : public a<tn>{
private:
void add(tn baz);
public:
b(tn bar, tn baz)
: a<tn>(bar)
{
add(baz);
}
};
template <typename tn>
void b<tn>::add(tn baz){
bar+=baz;
}
int main(){
b<unsigned> test(7,5);
std::cout << test.getBar() << std::endl;
return 0;
}
This gives
test.cpp: In member function `void b<tn>::add(tn)':
test.cpp:30: error: `bar' undeclared (first use this function)
test.cpp:30: error: (Each undeclared identifier is reported only once for each
function it appears in.)
As well as it's (in my and the opinion of ##c++) valid ANSI C++.
--
Summary: protected members of templated base class not accessible
in derived class
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tonne2005 at gehheimdienst dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21644
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/21644] protected members of templated base class not accessible in derived class
2005-05-18 12:36 [Bug c++/21644] New: protected members of templated base class not accessible in derived class tonne2005 at gehheimdienst dot de
@ 2005-05-18 12:37 ` tonne2005 at gehheimdienst dot de
0 siblings, 0 replies; 2+ messages in thread
From: tonne2005 at gehheimdienst dot de @ 2005-05-18 12:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tonne2005 at gehheimdienst dot de 2005-05-18 12:37 -------
*** This bug has been marked as a duplicate of 15552 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21644
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-05-18 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-18 12:36 [Bug c++/21644] New: protected members of templated base class not accessible in derived class tonne2005 at gehheimdienst dot de
2005-05-18 12:37 ` [Bug c++/21644] " tonne2005 at gehheimdienst dot de
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).