Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 12970
Product:  
Component:  
Status: RESOLVED
Resolution: INVALID
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: v.haisman@sh.cvut.cz
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 12970 depends on: Show dependency tree
Show dependency graph
Bug 12970 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2003-11-08 22:34
This simple C++ program gives the following error which seems strange to me.
GCC
3.3.1 compiles it fine.

$ g++ -W -Wall -o test test.cxx
test.cxx: In member function `void B<T>::foo(int)':
test.cxx:14: error: `x' undeclared (first use this function)
test.cxx:14: error: (Each undeclared identifier is reported only once for each
f
unction it appears in.)

----8<----------
template <typename T>
class A
{
protected:
  int x;
};

template <typename T>
class B : public A<T>
{
public:
  void foo (int _x)
  {
    x = _x;
  }
};

int main ()
{
  B<int> b;
  b.foo(1);
  return 0;
}
----8<----------

GCC is:
Reading specs from /usr/local/lib/gcc/i686-pc-cygwin/3.4/specs
Configured with: ../srcdir/configure --enable-languages=c,c++
--enable-threads=p
osix --enable-version-specific-runtime-libs --enable-dwarf2 --with-cpu=athlon
--
with-arch=athlon --without-included-gettext
Thread model: posix
gcc version 3.4 20031108 (experimental)

------- Comment #1 From Andrew Pinski 2003-11-08 22:37 -------
Can you read <http://gcc.gnu.org/gcc-3.4/changes.html>, GCC is correct to
reject this code.

------- Comment #2 From Wolfgang Bangerth 2003-11-10 14:56 -------
There's also a longer section in the non-bugs part of the manual
that explains what exactly is going on here.

W.

------- Comment #3 From Andrew Pinski 2006-01-13 15:41 -------
*** Bug 25783 has been marked as a duplicate of this bug. ***

------- Comment #4 From Andrew Pinski 2006-01-13 15:41 -------
*** Bug 24960 has been marked as a duplicate of this bug. ***

------- Comment #5 From Andrew Pinski 2006-01-13 15:42 -------
*** Bug 23976 has been marked as a duplicate of this bug. ***

------- Comment #6 From Andrew Pinski 2006-01-13 15:43 -------
*** Bug 23908 has been marked as a duplicate of this bug. ***

------- Comment #7 From Andrew Pinski 2006-01-13 15:44 -------
*** Bug 23755 has been marked as a duplicate of this bug. ***

------- Comment #8 From Andrew Pinski 2006-01-13 15:44 -------
*** Bug 23735 has been marked as a duplicate of this bug. ***

------- Comment #9 From Andrew Pinski 2006-01-13 15:45 -------
*** Bug 22588 has been marked as a duplicate of this bug. ***

------- Comment #10 From Andrew Pinski 2006-01-13 15:45 -------
*** Bug 16709 has been marked as a duplicate of this bug. ***

------- Comment #11 From Andrew Pinski 2006-01-13 15:46 -------
*** Bug 16577 has been marked as a duplicate of this bug. ***

------- Comment #12 From Andrew Pinski 2006-01-13 15:46 -------
*** Bug 16067 has been marked as a duplicate of this bug. ***

------- Comment #13 From Andrew Pinski 2006-01-13 15:47 -------
*** Bug 15372 has been marked as a duplicate of this bug. ***

------- Comment #14 From Andrew Pinski 2006-01-13 15:47 -------
*** Bug 15111 has been marked as a duplicate of this bug. ***

------- Comment #15 From Andrew Pinski 2006-01-13 15:48 -------
*** Bug 14376 has been marked as a duplicate of this bug. ***

------- Comment #16 From Andrew Pinski 2006-01-13 15:50 -------
*** Bug 15552 has been marked as a duplicate of this bug. ***

------- Comment #17 From Andrew Pinski 2006-01-17 21:02 -------
*** Bug 25827 has been marked as a duplicate of this bug. ***

------- Comment #18 From Andrew Pinski 2006-01-18 16:06 -------
*** Bug 25846 has been marked as a duplicate of this bug. ***

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug