Regression with pmfs??
Theodore Papadopoulo
Theodore.Papadopoulo@sophia.inria.fr
Tue Oct 27 04:02:00 GMT 1998
>
> You wrote:
>
> > typedef const double (B::*Func)() const;
> > const Func D1 = &A::A1;
> > const Func D2 = &A::A2;
> >
> > Note: The two line defining D1 and D2 do not compile if I remove the
> > class spec "A::". Why do I have to specify this ??
>
> That's the way a pointer to member is defined in ANSI C++:
>
> <quote>
> [expr.unary.op], clause 3:
> A pointer to member is only formed when an explicit & is used and its
> operand is a qualified-id not enclosed in parentheses. [Note: that
> is, the expression `&(qualified-id)', where the qualified-id is
> enclosed in parentheses, does not form an expression of type "pointer
> to member." Neither does `qualified-id', because there is no implicit
> conversion from a qaulified-id for a nonstatic member function to the
> type "pointer to member function" as there is from an lvalue of
> function type to the type "pointer to function" (4.3). Nor is
> `&unqualified-id' a pointer to member, even within the scope of the
> unqualified-id's class. ]
> </quote>
>
> A::A1 is a qualified id, A1 is a unqualified id.
Content-Transfer-Encoding: 8bit
Thank's for the explanation.
Yes, but B::A1 should work right ? Since B inherits publicly from A. But
that does not work.. (I wanted to say also that in the note but
forgot). Am I still missing something ?
Theo.
- --------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
More information about the Gcc-bugs
mailing list