forked from OSchip/llvm-project
Exclude invalid old decl from mismatching linkage assertion
This patch fixes PR18964. In linkage computation, assertion fails when an old invalid declaration's linkage mismatches with the current decl's one. llvm-svn: 203168
This commit is contained in:
parent
02548c08f8
commit
be19ae05e7
|
@ -1243,8 +1243,7 @@ public:
|
|||
|
||||
// We have just computed the linkage for this decl. By induction we know
|
||||
// that all other computed linkages match, check that the one we just
|
||||
// computed
|
||||
// also does.
|
||||
// computed also does.
|
||||
NamedDecl *Old = NULL;
|
||||
for (NamedDecl::redecl_iterator I = D->redecls_begin(),
|
||||
E = D->redecls_end();
|
||||
|
@ -1252,7 +1251,7 @@ public:
|
|||
NamedDecl *T = cast<NamedDecl>(*I);
|
||||
if (T == D)
|
||||
continue;
|
||||
if (T->hasCachedLinkage()) {
|
||||
if (!T->isInvalidDecl() && T->hasCachedLinkage()) {
|
||||
Old = T;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -213,3 +213,7 @@ namespace PR16247 {
|
|||
void pr16247_bar(int) {}
|
||||
void pr16247_bar(double) {}
|
||||
}
|
||||
namespace PR18964 {
|
||||
unsigned &*foo; //expected-error{{'foo' declared as a pointer to a reference of type}}
|
||||
extern struct {} *foo; // don't assert
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue