D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9129 - Definite return analysis fails for nested case statements
Summary: Definite return analysis fails for nested case statements
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-09 12:46 UTC by timon.gehr
Modified: 2023-02-11 07:39 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2012-12-09 12:46:01 UTC
DMD 2.060:

enum E{ v }
template Seq(T...){ alias T Seq; }
int foo(){
    E e;
    final switch(e){
        if(e) case E.v: return 0;
    }
    final switch(e)
    foreach(x;Seq!(E.v))
    case x: return 0;
}

Error: function foo no return exp; or assert(0); at end of function

The code should compile.
Comment 1 basile-z 2023-02-11 07:39:05 UTC
no more bad diagnostic since 2.069