www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17941] New: arity (and probably others) only consider the


          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 puremagic.com
          Reporter: andrei erdani.com


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.

Oct 26 2017