rsmith added a comment.
I think this is addressing a symptom rather than the cause. The bug appears to
be that when parsing a.h, we end up with inconsistent exception specifications
along the redeclaration chain. It looks like
`Sema::AdjustDestructorExceptionSpec` doesn't do the right thing when
befriending a destructor. Here's a non-modules testcase based on yours that
demonstrates either the same problem or at least a closely-related one:
struct B {
virtual ~B();
struct C { friend B::~B() noexcept; };
};
We produce a bogus error here ("exception specification in declaration does not
match previous declaration"). But we think the exception specifications match
if class `C` is moved outside class `B`.
Generally, we skip checking the exception specification for a destructor until
we get to the end of the class. But when the destructor declaration is a friend
declaration for a destructor of an enclosing class, we need to instead delay
until that enclosing class is complete. I expect the logic to do that is what's
missing here.
Repository:
rC Clang
https://reviews.llvm.org/D51608
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits