forked from OSchip/llvm-project
Check returned type is valid before using it.
Add a .isNull() check to returned QualType. Fixes PR38077 llvm-svn: 336475
This commit is contained in:
parent
9664ca9dce
commit
0282655f9d
|
@ -846,6 +846,9 @@ bool Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS,
|
|||
assert(DS.getTypeSpecType() == DeclSpec::TST_decltype);
|
||||
|
||||
QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
|
||||
if (T.isNull())
|
||||
return true;
|
||||
|
||||
if (!T->isDependentType() && !T->getAs<TagType>()) {
|
||||
Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class_or_namespace)
|
||||
<< T << getLangOpts().CPlusPlus;
|
||||
|
|
|
@ -28,3 +28,11 @@ namespace rdar9623945 {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace PR38077 {
|
||||
template <class T> void bar() {} // expected-note {{possible target for call}}
|
||||
|
||||
int run() {
|
||||
decltype(bar)::does_not_exist; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue