Skip to content
Closed
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
7 changes: 5 additions & 2 deletions compiler/src/dmd/typesem.d
Original file line number Diff line number Diff line change
Expand Up @@ -4041,8 +4041,11 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
}
else if (!fparam.isLazy() && t.ty == Tvoid)
{
.error(loc, "cannot have parameter of type `%s`", fparam.type.toChars());
errors = true;
if (!(sc.stc & STC.templateparameter))
{
.error(loc, "cannot have parameter of type `%s`", fparam.type.toChars());
errors = true;
}
}

const bool isTypesafeVariadic = i + 1 == dim && tf.parameterList.varargs == VarArg.typesafe;
Expand Down
15 changes: 15 additions & 0 deletions compiler/test/fail_compilation/test24740.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
REQUIRED_ARGS:
TEST_OUTPUT:
---
fail_compilation/test24740.d(12): Error: cannot have parameter of type `void`
fail_compilation/test24740.d(15): Error: template instance `test24740.Bug!void` error instantiating
---
*/

template Bug(T)
{
void BUG(T t){}
}

alias b = Bug!void;
Loading