[Issue 17941] New: arity (and probably others) only consider the first lexically present function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 26 16:18:32 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17941

          Issue ID: 17941
           Summary: arity (and probably others) only consider the first
                    lexically present function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Consider:

import std.traits;

void fun(int);
void fun(int, int);

void gun(int, int);
void gun(int);

static assert(arity!fun == 1);
static assert(arity!gun == 2);

This code passes, indicating that only the first name in lexical order of an
overload set is considered by arity. This is definitely surprising. Worst case
the behavior should be documented, but a real solution would allow people to
indicate which overload they're interested in.

--


More information about the Digitalmars-d-bugs mailing list