Index: lib/Analysis/Consumed.cpp =================================================================== --- lib/Analysis/Consumed.cpp +++ lib/Analysis/Consumed.cpp @@ -1442,7 +1442,7 @@ CurrStates, WarningsHandler); - if (BlockInfo.allBackEdgesVisited(*SI, CurrBlock)) + if (BlockInfo.allBackEdgesVisited(CurrBlock, *SI)) BlockInfo.discardInfo(*SI); } else { BlockInfo.addInfo(*SI, CurrStates, OwnershipTaken); Index: test/SemaCXX/warn-consumed-analysis.cpp =================================================================== --- test/SemaCXX/warn-consumed-analysis.cpp +++ test/SemaCXX/warn-consumed-analysis.cpp @@ -638,6 +638,18 @@ *var0; // expected-warning {{invalid invocation of method 'operator*' on object 'var0' while it is in the 'consumed' state}} } +// Tests if state information is correctly discarded for certain shapes of CFGs. +void testSwitchGOTO(void) { + int a; + + LABEL0: + switch (a) + case 0: + goto LABEL0; + + goto LABEL0; +} + typedef const int*& IntegerPointerReference; void testIsRValueRefishAndCanonicalType(IntegerPointerReference a) {}