Open frederick-vs-ja opened 1 week ago
CC @erichkeane
I don't know the historical reason here, but I think I dislike this behavior as well. It is really unfortunate, and I would expect that because the declaration successfully instantiated, that we could just leave the body with a RecoveryExpr
/ExprError
in it in this case instead.
But I don't have a good hold as to why this has happened. It might be worth tracking down what patch caused this.
Actually... looking at Godbolt, I don't think there IS any change in behavior for this, it looks like Clang was just giving up after that first error on that before. So I am no longer sure that tracking down a patch would be beneficial.
Currently, when the same ill-formed function template specialization is instantiated more than once, Clang emits strange error messages. Godbolt link.
Error messages:
It seems that Clang treats the ill-formedness after the first instantiation failure as something like substitution failure.
Clang started to behave like this since 3.4, while MSVC and GCC don't do so. It's unclear to me whether this is intended.