public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20578] New: Problem with templates
@ 2005-03-21 15:30 mah at systematic dot dk
  2005-03-21 15:33 ` [Bug c++/20578] " pinskia at gcc dot gnu dot org
  2005-03-21 15:49 ` mah at systematic dot dk
  0 siblings, 2 replies; 3+ messages in thread
From: mah at systematic dot dk @ 2005-03-21 15:30 UTC (permalink / raw)
  To: gcc-bugs

The following C++ code does not compile, which I believe it should (It 
compiles on gcc 1.1.1 and Microsoft's VS.NET):

--------Code start--------
template <class T>
class A {
protected:
  int a;
};

template <class T>
class B: public A<T> {
public:
  void f() { a = 5; }
};
--------Code end--------
I get the following error:
test.cpp: In member function `void B<T>::f()':
test.cpp:10: error: `a' undeclared (first use this function)
test.cpp:10: error: (Each undeclared identifier is reported only once for each 
function it appears in.)
asterix:components/mde> /pack/gcc/3.4.3/bin/g++ test.cpptest.cpp: In member 
function `void B<T>::f()':
test.cpp:10: error: `a' undeclared (first use this function)
test.cpp:10: error: (Each undeclared identifier is reported only once for each 
function it appears in.)

-- 
           Summary: Problem with templates
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mah at systematic dot dk
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20578


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-21 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-21 15:30 [Bug c++/20578] New: Problem with templates mah at systematic dot dk
2005-03-21 15:33 ` [Bug c++/20578] " pinskia at gcc dot gnu dot org
2005-03-21 15:49 ` mah at systematic dot dk

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).