This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11906] New: Member pointer to inherited field has wrong type
- From: "schnetter at uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2003 17:44:49 -0000
- Subject: [Bug c++/11906] New: Member pointer to inherited field has wrong type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11906
Summary: Member pointer to inherited field has wrong type
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schnetter at uni-tuebingen dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-linux
I am using a member pointer that should point to an inherited field in a
template class. For some reason, the type is converted to a member pointer to
the parent type. This does not occur if the data structures are not
templates. The code is
template<int D>
struct parent {
double u;
};
template<int D>
struct child : parent<D> { };
template<int D>
void
copy (double child<D>::* const var);
void
rhs ()
{
copy (&child<0>::u);
copy ((double child<0>::*) &child<0>::u);
}
The reported error message is
$ g++ -g3 -Wall -c mp.cc
mp.cc: In function `void rhs()':
mp.cc:20: error: no matching function for call to `copy(double parent<0>::*)'
Line 20 is the first line in the function rhs. The second line is accepted
without complaint, and shows the type that I expected the expression to have
in the first place.