Skip to content

Commit

Permalink
Fix issue 19456 - ParameterIdentifierTuple incorrect for abstract met…
Browse files Browse the repository at this point in the history
…hods with unnamed parameters
  • Loading branch information
Biotronic committed Dec 3, 2018
1 parent e87b111 commit 9f9988b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion std/traits.d
Expand Up @@ -1381,7 +1381,9 @@ if (func.length == 1 && isCallable!func)
{
static if (!isFunctionPointer!func && !isDelegate!func
// Unnamed parameters yield CT error.
&& is(typeof(__traits(identifier, PT[i .. i+1]))))
&& is(typeof(__traits(identifier, PT[i .. i+1])))
// Filter out unnamed args, which look like (Type) instead of (Type name).
&& PT[i].stringof != PT[i .. i+1].stringof[1..$-1])
{
enum Get = __traits(identifier, PT[i .. i+1]);
}
Expand Down Expand Up @@ -1418,6 +1420,16 @@ if (func.length == 1 && isCallable!func)
static assert([ParameterIdentifierTuple!foo] == ["num", "name", ""]);
}

// Issue 19456
@safe unittest
{
struct SomeType {}
void foo(SomeType);
void bar(int);
static assert([ParameterIdentifierTuple!foo] == [""]);
static assert([ParameterIdentifierTuple!bar] == [""]);
}

@safe unittest
{
alias PIT = ParameterIdentifierTuple;
Expand Down

0 comments on commit 9f9988b

Please sign in to comment.