mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
Fix Issue 23914 - auto ref resolution on return value prevented by noreturn (#15240)
This commit is contained in:
parent
923bc30a56
commit
a19be2d341
2 changed files with 6 additions and 5 deletions
|
@ -2732,7 +2732,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
|
|||
tbret = tret.toBasetype();
|
||||
}
|
||||
|
||||
if (inferRef) // deduce 'auto ref'
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23914
|
||||
if (inferRef && !resType.isTypeNoreturn()) // deduce 'auto ref'
|
||||
tf.isref = false;
|
||||
|
||||
if (tbret.ty != Tvoid && !resType.isTypeNoreturn()) // if non-void return
|
||||
|
|
|
@ -91,8 +91,8 @@ auto ref forwardOrExit(ref int num)
|
|||
|
||||
static assert( is(typeof(forwardOrExit(global)) == int));
|
||||
|
||||
// // Must not infer ref due to the noreturn rvalue
|
||||
static assert(!is(typeof(&forwardOrExit(global))));
|
||||
// Noreturn types do not affect `auto ref` deduction
|
||||
static assert(is(typeof(&forwardOrExit(global))));
|
||||
|
||||
auto ref forwardOrExit2(ref int num)
|
||||
{
|
||||
|
@ -104,8 +104,8 @@ auto ref forwardOrExit2(ref int num)
|
|||
|
||||
static assert( is(typeof(forwardOrExit2(global)) == int));
|
||||
|
||||
// // Must not infer ref due to the noreturn rvalue
|
||||
static assert(!is(typeof(&forwardOrExit2(global))));
|
||||
// Noreturn types do not affect `auto ref` deduction
|
||||
static assert(is(typeof(&forwardOrExit2(global))));
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue