Specifically, Clang currently errors on the following code:<div><br></div><div>struct X {};</div><div>X::X x;</div><div><br></div><div>As the type specifier 'X::X' isn't a valid use of the injected class name, it instead names the constructor. The code in question performs error recovery as if this *did* name the type already, but doesn't suggest a fixit hint to make it actually name the type. This patch adds that fixit hint.</div>
<div><br></div><div>I have a tiny reservation here that there might be cases where the suggestion change to the code doesn't actually match the recovery's interpretation of 'X::X', specifically a context wherhe 'X' alone wouldn't name a class type, but 'X::X' would if it were allowed. I don't think any such case exists, but it might, so I wanted to run it by folks first.</div>
<div><br></div><div>My code doesn't fire for templates, one obvious case where the injected-class-name is substantially different from the nominating name in the NNS (in that the injected-class-name is a class-name, while the NNS would end in a template-id). And the standard clarifies that base class's injected-class-name can still be used in these contexts so it shouldn't fire there.</div>