summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2016-10-28 00:15:24 +0000
committerRichard Trieu <rtrieu@google.com>2016-10-28 00:15:24 +0000
commit42b98e2a824a234c69b46fe26b87906a5eb198d5 (patch)
treedce319fff7cc0c2bea9ea6778ab1b78c689e3bbe /clang/test
parented2977fabe45764608ac82d7239a6e08d575a781 (diff)
downloadbcm5719-llvm-42b98e2a824a234c69b46fe26b87906a5eb198d5.tar.gz
bcm5719-llvm-42b98e2a824a234c69b46fe26b87906a5eb198d5.zip
Fix a crash on invalid code.
The diagnostic was attempting to access the QualType of a TypeDecl by calling TypeDecl::getTypeForDecl. However, the Type pointer stored there is lazily loaded by functions in ASTContext. In most cases, the pointer is loaded and this does not cause a problem. However, when more that 50 or so unknown types are seen beforehand, this causes the Type to not be loaded, passing a null Type to the diagnostics, leading to the crash. Using ASTContext::getTypeDeclType will give a proper QualType for all cases. llvm-svn: 285370
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/nested-name-spec.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp
index 0fbdedc70a6..f445725c742 100644
--- a/clang/test/SemaCXX/nested-name-spec.cpp
+++ b/clang/test/SemaCXX/nested-name-spec.cpp
@@ -435,3 +435,21 @@ namespace PR16951 {
// expected-error{{no member named 'X2' in 'PR16951::enumerator_2'}}
}
+
+namespace PR30619 {
+c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d;
+// expected-error@-1 16{{unknown type name 'c'}}
+c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d;
+// expected-error@-1 16{{unknown type name 'c'}}
+c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d;
+// expected-error@-1 16{{unknown type name 'c'}}
+c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d; c d;
+// expected-error@-1 16{{unknown type name 'c'}}
+namespace A {
+class B {
+ typedef C D; // expected-error{{unknown type name 'C'}}
+ A::D::F;
+ // expected-error@-1{{'D' (aka 'int') is not a class, namespace, or enumeration}}
+};
+}
+}
OpenPOWER on IntegriCloud