mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
Deprecate typesafe variadic class arguments (#20673)
This commit is contained in:
parent
0131a00173
commit
961862c455
5 changed files with 53 additions and 50 deletions
|
@ -2493,10 +2493,17 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
|
|||
errors = true;
|
||||
}
|
||||
|
||||
const bool isTypesafeVariadic = i + 1 == dim &&
|
||||
tf.parameterList.varargs == VarArg.typesafe &&
|
||||
(t.isTypeDArray() || t.isTypeClass());
|
||||
if (isTypesafeVariadic)
|
||||
const bool isTypesafeVariadic = i + 1 == dim && tf.parameterList.varargs == VarArg.typesafe;
|
||||
const bool isStackAllocatedVariadic = isTypesafeVariadic && (t.isTypeDArray() || t.isTypeClass());
|
||||
|
||||
if (isTypesafeVariadic && t.isTypeClass())
|
||||
{
|
||||
// Deprecated in 2.111, kept as a legacy feature for compatibility (currently no plan to turn it into an error)
|
||||
.deprecation(loc, "typesafe variadic parameters with a `class` type (`%s %s...`) are deprecated",
|
||||
t.isTypeClass().sym.ident.toChars(), fparam.toChars());
|
||||
}
|
||||
|
||||
if (isStackAllocatedVariadic)
|
||||
{
|
||||
/* typesafe variadic arguments are constructed on the stack, so must be `scope`
|
||||
*/
|
||||
|
@ -2518,7 +2525,7 @@ Type typeSemantic(Type type, Loc loc, Scope* sc)
|
|||
}
|
||||
}
|
||||
|
||||
if (isTypesafeVariadic)
|
||||
if (isStackAllocatedVariadic)
|
||||
{
|
||||
/* This is because they can be constructed on the stack
|
||||
* https://dlang.org/spec/function.html#typesafe_variadic_functions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue