aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-10-10 23:15:05 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-10-10 23:15:05 +0000
commit3ea19c8307932655092235b57f04a5e6658bbc46 (patch)
tree2e504fcbc9706f4822b0159b8530f03acde93514
parentb9966bd81878c6627d702368d6c4a8bc62bc01ac (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165675 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseDecl.cpp1
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp3
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp5
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 52bd4166bb..3ef4f38ad0 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -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()) {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
index f732255a8a..e91cacf104 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
@@ -86,3 +86,6 @@ namespace PR13293 {
template void h<double>();
}
#endif
+
+auto fail((unknown)); // expected-error{{use of undeclared identifier 'unknown'}}
+int& crash = fail;
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index 582701957e..8bf2560417 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -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>'}}
}
}