[Bug c++/21008] [3.4/4.0/4.1 Regression] Acess failure in accessing data member of base class from derived template class
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 19 18:25:00 GMT 2005
------- Additional Comments From bangerth at dealii dot org 2005-04-19 18:25 -------
Martin & Mike,
I'm happy to reopen this PR. I understand your analysis, and in fact thought
about it when I wrote my comment. Independently of whether it may be strictly
mandated by the standard, I do have to admit that I find it confusing to see
the semantics of something change at the time of instantiation, even though
it was already bound at template definition time. I do think that this is
a further complication of the already not quite so intuitive two-stage
name lookup rules.
But I guess that's immaterial. We're not into intuitive things, but into
the letter of the law. Some people in this country already claim that
lawyers stray too far from the letter of the law anyway, so we won't give
them more reason to complain.
Incidentally, two question:
a) your reference to 9.3.1p3 must have been to something else. In TC1,
9.3.1 is on const and volatile member functions.
b) how does your interpretation affect the validity of the following program:
------------------
struct A {
int foo_;
};
typedef int A::* pAi;
template <typename T> struct B: public A { };
template <typename T> struct C: B<T> {
pAi foo() {
return &A::foo_;
}
};
-----------------
If A::foo_ refers to the member variable *of the present object*, then
taking its address returns an int*, not an "int A::*" object, right? However,
I can't seem to find a compiler that would reject the code.
Thanks
Wolfgang
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sebor at roguewave dot com,
| |bangerth at dealii dot org
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21008
More information about the Gcc-bugs
mailing list