Don't correct non-class using declarations to class members.

Such declarations would be invalid anyway, and trying to make the
correction will lead to a crash. Fixes PR 24781.

llvm-svn: 248928
This commit is contained in:
Kaelyn Takata 2015-09-30 18:23:35 +00:00
parent b0c6d9174e
commit d14c06169c
2 changed files with 20 additions and 0 deletions

View File

@ -8031,6 +8031,10 @@ public:
// FIXME: Check that the base class member is accessible?
}
} else {
auto *FoundRecord = dyn_cast<CXXRecordDecl>(ND);
if (FoundRecord && FoundRecord->isInjectedClassName())
return false;
}
if (isa<TypeDecl>(ND))

View File

@ -640,3 +640,19 @@ int has_include(int); // expected-note {{'has_include' declared here}}
// expected-error@+1 {{__has_include must be used within a preprocessing directive}}
int foo = __has_include(42); // expected-error {{use of undeclared identifier '__has_include'; did you mean 'has_include'?}}
}
namespace PR24781_using_crash {
namespace A {
namespace B {
class Foofoo {}; // expected-note {{'A::B::Foofoo' declared here}}
}
}
namespace C {
namespace D {
class Bar : public A::B::Foofoo {};
}
}
using C::D::Foofoo; // expected-error {{no member named 'Foofoo' in namespace 'PR24781_using_crash::C::D'; did you mean 'A::B::Foofoo'?}}
}