Open
Description
See the example below, it would be nice for clang to diagnose this case.
https://godbolt.org/z/W3dhEzY6M
#include <vector>
using namespace std;
int main()
{
// Good: Initializing an initializer_list object from the array extends the
// lifetime of the array exactly like binding a reference to a temporary.
initializer_list<int> a = {1, 2, 3};
// Dangerous! the lifetime of the backing array is not extended for assignments.
//
// A holds dangling pointers into backing array which are destroyed at the end of full expression.
a = {2, 3, 4};
for (int i : a) {
i;
}
}