On Mar 5, 2014, at 4:15 PM, David Blaikie <[email protected]> wrote:

>> +MyEnum trivial_dead_return_enum_2(int x) {
>> +  switch (x) {
>> +    case 1: return 1;
>> +    case 2: return 2;
>> +    case 3: return 3;
>> +  }
>> +
>> +  return 2; // no-warning
> 
> Wow - was this return really considered 'dead' at some point? How/why?
> That looks totally reachable...
> 
>> +}
>> +
>> +MyEnum nontrivial_dead_return_enum_2(int x) {
>> +  switch (x) {
>> +    case 1: return 1;
>> +    case 2: return 2;
>> +    case 3: return 3;
>> +    default: return 4;
>> +  }
>> +
>> +  return calledFun(); // expected-warning {{will never be executed}}
> 
> Did this not warn previously?

These two test cases are meant to be the same other than the return value in 
the second case is “non-trivial”, and thus we should warn.  The first test is 
missing the “default” case.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to