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:
David Blaikie 2012-10-10 23:15:05 +00:00
parent 27678b0961
commit eae04111d0
3 changed files with 7 additions and 2 deletions

View File

@ -1680,6 +1680,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D,
}
if (ParseExpressionList(Exprs, CommaLocs)) {
Actions.ActOnInitializerError(ThisDecl);
SkipUntil(tok::r_paren);
if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) {

View File

@ -86,3 +86,6 @@ namespace PR13293 {
template void h<double>();
}
#endif
auto fail((unknown)); // expected-error{{use of undeclared identifier 'unknown'}}
int& crash = fail;

View File

@ -42,10 +42,11 @@ void test_dependent_init(T *p) {
}
namespace PR6948 {
template<typename T> class X;
template<typename T> class X; // expected-note{{template is declared here}}
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>'}}
}
}