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

* [Bug c++/20578] Problem with templates
  2005-03-21 15:30 [Bug c++/20578] New: Problem with templates mah at systematic dot dk
@ 2005-03-21 15:33 ` pinskia at gcc dot gnu dot org
  2005-03-21 15:49 ` mah at systematic dot dk
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-21 15:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-21 15:32 -------
No this should not compile.  a is not dependent so it needs to be looked up at the point of the 
definition and not instaination.

Read the 3.4.x release notes to figure out how to fix your code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/20578] Problem with templates
  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
  1 sibling, 0 replies; 3+ messages in thread
From: mah at systematic dot dk @ 2005-03-21 15:49 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]


------- Additional Comments From mah at systematic dot dk  2005-03-21 15:49 -------
Subject: RE:  Problem with templates

Thank you for an extreemly quick response. My code is now compiling:-)


Med venlig hilsen / kind regards

Martin Hansen 
Lead Architect, Products

Systematic Software Engineering A/S
Søren Frichs Vej 39, DK-8000  Aarhus C
Tel.: +45 8943 2123
Fax: +45 8943 2020
Web: www.systematic.dk  


-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org] 
Sent: 21. marts 2005 16:33
To: Martin Hansen
Subject: [Bug c++/20578] Problem with templates


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-21 15:32 ------- No this should not compile.  a is not dependent so it needs to be looked up at the point of the definition and not instaination.

Read the 3.4.x release notes to figure out how to fix your code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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

------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter.




-- 


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