[Bug c++/31525] New: b was not declared in this scope in inherited template class

2007-04-10 Thread edufer at gmail dot com
Fails on 4.1.2 and 3.4.2. Works on 3.2.2

When compiling the following code:

template  class A {
protected:
int b;
};

template  class B :  public A<_T> {
public:
void test_ok() {
this->b = 17;
}

void test_fail() {
b = 17;
}
};

The method test_ok compiles OK but the test_fails gets the following error:

bug-gcc.cpp: In member function void B<_T>::test_fail():
bug-gcc.cpp:18: error: b was not declared in this scope

The full command line is:

gcc -v -save-temps bug-gcc.cpp
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure 
Thread model: posix
gcc version 4.1.2
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.1.2/cc1plus -E -quiet -v
-D_GNU_SOURCE bug-gcc.cpp -mtune=pentiumpro -fpch-preprocess -o bug-gcc.ii
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2

/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i686-pc-linux-gnu

/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include
 /usr/include
End of search list.
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.1.2/cc1plus -fpreprocessed
bug-gcc.ii -quiet -dumpbase bug-gcc.cpp -mtune=pentiumpro -auxbase bug-gcc
-version -o bug-gcc.s
GNU C++ version 4.1.2 (i686-pc-linux-gnu)
compiled by GNU C version 4.1.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8b499b4064e5e336c763bb8a820d240c
bug-gcc.cpp: In member function void B<_T>::test_fail():
bug-gcc.cpp:18: error: b was not declared in this scope

Many thanks for your help.

Edu.


-- 
   Summary:  b was not declared in this scope in inherited
template class
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: edufer at gmail dot com
  GCC host triplet: i686-pc-linux-gnu


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



[Bug c++/31525] b was not declared in this scope in inherited template class

2007-04-10 Thread edufer at gmail dot com


--- Comment #1 from edufer at gmail dot com  2007-04-10 12:26 ---
Created an attachment (id=13342)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13342&action=view)
Sample code


-- 


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



[Bug c++/31525] b was not declared in this scope in inherited template class

2007-04-10 Thread edufer at gmail dot com


--- Comment #3 from edufer at gmail dot com  2007-04-10 13:28 ---
(In reply to comment #2)
> This is conforming behavior, implemented for the first time in the 3.4.x
> release series:
>   http://gcc.gnu.org/gcc-3.4/changes.html

Correct. Many thanks for your time.


-- 


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