Closed mgehre closed 5 years ago
Is this the whole example? It does not compile for me ( e.g semicolon is missing for the last class).
I just quickly copied the output from creduce, maybe something went wrong. Will check
I can confirm that this crash when executed with /build/bin/clang-9 -fsyntax-only -Wlifetime source.cpp
. Interestingly, without -Wlifetime, I get
/tmp/cmTryRunCommand-005ce2.reduced.cpp:7:15: warning: expression result unused [-Wunused-value]
b begin() { c; }
^
/tmp/cmTryRunCommand-005ce2.reduced.cpp:7:18: warning: control reaches end of non-void function [-Wreturn-type]
b begin() { c; }
^
/tmp/cmTryRunCommand-005ce2.reduced.cpp:10:2: error: expected ';' after class
}
^
;
/tmp/cmTryRunCommand-005ce2.reduced.cpp:7:5: error: functions cannot be declared in an anonymous struct
b begin() { c; }
^
/tmp/cmTryRunCommand-005ce2.reduced.cpp:8:8: error: functions cannot be declared in an anonymous struct
void end();
^
/tmp/cmTryRunCommand-005ce2.reduced.cpp:9:5: error: anonymous struct cannot contain a private data member
b c;
^
/tmp/cmTryRunCommand-005ce2.reduced.cpp:6:1: error: anonymous structs and classes must be class members
but with -Wlifetime
I only see the warnings
warning: expression result unused [-Wunused-value]
warning: control reaches end of non-void function [-Wreturn-type]
and then the crash. I lifetime analysis runs before the analysis that emits the errors.
Hm, this seems to be not a problem on the lifetime branch, only my local copy.
Assert with