public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37910] New: Must use 'this' to access member
@ 2008-10-24 14:10 lyricsfan at lycos dot com
2008-10-24 14:13 ` [Bug c++/37910] " lyricsfan at lycos dot com
2008-10-24 14:24 ` paolo dot carlini at oracle dot com
0 siblings, 2 replies; 3+ messages in thread
From: lyricsfan at lycos dot com @ 2008-10-24 14:10 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/37910] Must use 'this' to access member
2008-10-24 14:10 [Bug c++/37910] New: Must use 'this' to access member lyricsfan at lycos dot com
@ 2008-10-24 14:13 ` lyricsfan at lycos dot com
2008-10-24 14:24 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: lyricsfan at lycos dot com @ 2008-10-24 14:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from lyricsfan at lycos dot com 2008-10-24 14:11 -------
one more thing: when inheriting from, say, X<int>, all is fine.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37910
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/37910] Must use 'this' to access member
2008-10-24 14:10 [Bug c++/37910] New: Must use 'this' to access member lyricsfan at lycos dot com
2008-10-24 14:13 ` [Bug c++/37910] " lyricsfan at lycos dot com
@ 2008-10-24 14:24 ` paolo dot carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-24 14:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2008-10-24 14:23 -------
Yes, this is the right behaviour, conforming to the C++ Standard. It has been
announced in the 3.4.x release notes:
http://gcc.gnu.org/gcc-3.4/changes.html
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37910
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-24 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24 14:10 [Bug c++/37910] New: Must use 'this' to access member lyricsfan at lycos dot com
2008-10-24 14:13 ` [Bug c++/37910] " lyricsfan at lycos dot com
2008-10-24 14:24 ` paolo dot carlini at oracle dot com
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).