function overloading of address
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Tue Dec 2 18:31:11 PST 2014
On Tue, 2 Dec 2014 18:18:26 -0800
"H. S. Teoh via Digitalmars-d" <digitalmars-d at puremagic.com> wrote:
> On Wed, Dec 03, 2014 at 02:11:54AM +0000, bearophile via Digitalmars-d wrote:
> > sdvcn:
> >
> > >void ac(int aa)
> > >{
> > >}
> > >
> > >void ac(void *a2)
> > >{
> > >}
> > >
> > >int main(string[] argv)
> > >{
> > >auto v = ∾ //<--- who address
> > >}
> > >
> > >
> > >who get "void ac(int aa)" address ?
> >
> > This code:
> >
> >
> > void foo(int) {}
> > void foo(void*) {}
> >
> > void main() {
> > auto pfoo = &foo;
> > }
> >
> >
> > Gives:
> >
> > test.d(5,17): Error: cannot infer type from overloaded function symbol & foo
> [...]
>
> How do you take the address of specific overload, though?
declare the necessary function type instead of auto:
void function (int) pfoo = &foo;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141203/c0d4a808/attachment-0001.sig>
More information about the Digitalmars-d
mailing list