[Bug c++/37910] New: Must use 'this' to access member
lyricsfan at lycos dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 24 14:10:00 GMT 2008
g++ 4.3.2
linux 2.6.11.7 (gentoo)
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3.2/configure --prefix=<something>
Thread model: posix
gcc version 4.3.2 (GCC)
g++ test.cpp
Error when condition detailed at the end is met:
test.cpp: In constructor 'Y<T>::Y()':
test.cpp:5: error: 'i' was not declared in this scope
test.ii
# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.cpp"
template<class T> struct X {
int i;
};
template<class T> struct Y : public X<T> {
Y() { i = 100; }
};
int main() {
Y<double> y;
}
test.s
.file "test.cpp"
***
The above code does not correctly compile if 'this->' is removed ('double' and
'int' are dummy types), while g++ 3.3.6 works as expected.
Also not working: g++ 3.4.6 (no other version tried).
--
Summary: Must use 'this' to access member
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lyricsfan at lycos dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37910
More information about the Gcc-bugs
mailing list