During import of a class template, lookup may find a forward declaration and structural match falsely reports equivalency in between a fwd decl and a definition. This results that some definitions are not imported if we had imported a fwd decl previously. This patch gives a fix.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
During import of a class template, lookup may find a forward declaration and structural match falsely reports equivalency in between a fwd decl and a definition.
This can happen when the class to be imported does not have any data members. Structural equivalency check the data members only (and not any of the member functions).
Hello Gabor,
Thank you for the patch. It looks mostly good, but I have a question: should we add this new declaration to the redeclaration chain like we do it for RecordDecls?
should we add this new declaration to the redeclaration chain like we do it for RecordDecls?
I think, on a long term we should. Otherwise we could loose e.g. C++11 attributes which are attached to the forward declaration only.
However, I'd do that as a separate commit, because that would require some independent changes and tests, also other decl kinds like ClassTemplateSepcializationDecl may be affected as well by that.