As part of preparing Clang for a C++14 default we noticed that code like this was accepted and did horrible things in C++11 or earlier modes (i.e. where 1.0if is a _Complex float rather than a UDL):
std::complex<float> var = 1.0if;
This is because 1.0if is implicitly cast to a plain float, discarding the imaginary part. Then the constructor is called with just this real part and a default 0.0f for the imaginary part.
To avoid this surprising behaviour (and to follow GCC's behaviour) this patch bans such conversions in C++ mode. We can't do it in C99 because it's blessed by the standard.
As part of this some OpenMP and warning tests became irrelevant (again, in line with GCC) so I removed them.
My biggest annoyance is the new diagnostic; I couldn't see a way to promote the existing warning to an error in C++ mode so I duplicated the warning and chose at runtime. I'd be happy to rework if there is a better alternative.
Does it look reasonable?
I think that, as an error, we should word this differently. How about: