Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ddmd/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,9 @@ extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc)
}
ex = ex.ctfeInterpret();
auto ii = ex.toUInteger();
if (ii >= fparams.dim)
if (ii >= Parameter.dim(fparams))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the error message should show the new upper limit, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

{
e.error("parameter index must be in range 0..%u not %s", cast(uint)fparams.dim, ex.toChars());
e.error("parameter index must be in range 0..%u not %s", cast(uint)Parameter.dim(fparams), ex.toChars());
return new ErrorExp();
}

Expand Down
13 changes: 13 additions & 0 deletions test/runnable/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,19 @@ void test12237()

/********************************************************/

void async(ARGS...)(ARGS)
{
static void compute(ARGS)
{
}

auto x = __traits(getParameterStorageClasses, compute, 1);
}

alias test17495 = async!(int, int);

/********************************************************/

int main()
{
test1();
Expand Down