forked from OSchip/llvm-project
Fix a crash-on-invalid when parsing a reference to an invalid auto declaration
auto x((unknown)); int& y = x; would crash because we were not flagging 'x' as an invalid declaration here. llvm-svn: 165675
This commit is contained in:
parent
27678b0961
commit
eae04111d0
|
@ -1680,6 +1680,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseExpressionList(Exprs, CommaLocs)) {
|
if (ParseExpressionList(Exprs, CommaLocs)) {
|
||||||
|
Actions.ActOnInitializerError(ThisDecl);
|
||||||
SkipUntil(tok::r_paren);
|
SkipUntil(tok::r_paren);
|
||||||
|
|
||||||
if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
|
|
|
@ -86,3 +86,6 @@ namespace PR13293 {
|
||||||
template void h<double>();
|
template void h<double>();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
auto fail((unknown)); // expected-error{{use of undeclared identifier 'unknown'}}
|
||||||
|
int& crash = fail;
|
||||||
|
|
|
@ -42,10 +42,11 @@ void test_dependent_init(T *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PR6948 {
|
namespace PR6948 {
|
||||||
template<typename T> class X;
|
template<typename T> class X; // expected-note{{template is declared here}}
|
||||||
|
|
||||||
void f() {
|
void f() {
|
||||||
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
|
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}} \
|
||||||
|
expected-error{{implicit instantiation of undefined template 'PR6948::X<char>'}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue