The assertion fails when a function with a default argument that materializes a temporary is called more than once in an expression. The assertion fails in CallStackFrame::createTemporary when it searches map Temporaries using the default argument's expression (which is a MaterializeTemporaryExpr) as the key and it discovers that there is already an element with that key that has been initialized.
constexpr bool equals(const float& arg = 1.0f) { return arg == 1.0f; } constexpr bool test_default_arg() { return equals() && equals(); }
This patch removes the assertion and makes CallStackFrame::createTemporary reset the existing element and return it if the element is found in the map.
rdar://problem/36505742
Have you considered using a pair<const void*, unsigned> as the key rather than a map-of-maps? It'd be preferable to only allocate one heap node rather than two for the (hopefully common) case where there is only one version of an object.