diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-22 18:52:25 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-22 18:52:25 +0000 |
| commit | 8e4be0b1ea01f54b16f7aab671f52739735ead20 (patch) | |
| tree | 886ab9ef7f9127dec569dcc813b720650a034df3 | |
| parent | 341c11da3bda1a3f877a3dc6e96f7d1f866f703f (diff) | |
| download | bcm5719-llvm-8e4be0b1ea01f54b16f7aab671f52739735ead20.tar.gz bcm5719-llvm-8e4be0b1ea01f54b16f7aab671f52739735ead20.zip | |
Don't enter a qualified scope for an invalid decl.
Fixes assertion later on. rdar://9122937 & http://llvm.org/PR9459
llvm-svn: 130006
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/PR9459.cpp | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 88193f54642..53a7c73998e 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -7639,7 +7639,7 @@ bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) { /// class X. void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) { // If there is no declaration, there was an error parsing it. - if (D == 0) return; + if (D == 0 || D->isInvalidDecl()) return; // We should only get called for declarations with scope specifiers, like: // int foo::bar; @@ -7651,7 +7651,7 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) { /// initializer for the out-of-line declaration 'D'. void Sema::ActOnCXXExitDeclInitializer(Scope *S, Decl *D) { // If there is no declaration, there was an error parsing it. - if (D == 0) return; + if (D == 0 || D->isInvalidDecl()) return; assert(D->isOutOfLine()); ExitDeclaratorContext(S); diff --git a/clang/test/SemaCXX/PR9459.cpp b/clang/test/SemaCXX/PR9459.cpp new file mode 100644 index 00000000000..33cb2e5bc29 --- /dev/null +++ b/clang/test/SemaCXX/PR9459.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Don't crash. + +template<typename>struct ae_same; // expected-note {{declared here}} +template<typename>struct ts{}ap() +{ts<a>::ap<ae_same<int>::&ae_same<>>::p(a); }; // expected-error 2 {{undeclared identifier}} \ + // expected-error 2 {{expected}} expected-error {{a space is required}} \ + // expected-error 2 {{global}} expected-error {{too few}} |

