summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2018-09-10 21:54:04 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2018-09-10 21:54:04 +0000
commite2195ee646f395f30f79a8124aa7d23eda0dc4f2 (patch)
tree9dc7946f9db7e3ffb8e9bd31668c760e3e7f5014
parent6fb021633b2feea30712f52290b07d222521614e (diff)
downloadclang-e2195ee646f395f30f79a8124aa7d23eda0dc4f2.tar.gz
[AST] Fix a crash on invalid.
Problem was that we were appending to the source location info buffer in the copy assignment operator (instead of overwriting). rdar://42746401 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341869 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/NestedNameSpecifier.cpp1
-rw-r--r--test/SemaCXX/rdar42746401.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp
index a514d57b6b..df23972af2 100644
--- a/lib/AST/NestedNameSpecifier.cpp
+++ b/lib/AST/NestedNameSpecifier.cpp
@@ -547,6 +547,7 @@ operator=(const NestedNameSpecifierLocBuilder &Other) {
}
// Deep copy.
+ BufferSize = 0;
Append(Other.Buffer, Other.Buffer + Other.BufferSize, Buffer, BufferSize,
BufferCapacity);
return *this;
diff --git a/test/SemaCXX/rdar42746401.cpp b/test/SemaCXX/rdar42746401.cpp
new file mode 100644
index 0000000000..ff9dff456c
--- /dev/null
+++ b/test/SemaCXX/rdar42746401.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <int>
+class b;
+class c; // expected-note{{forward declaration}}
+
+::b<0> struct c::d // expected-error{{incomplete type}} expected-error{{cannot combine}} expected-error{{expected unqualified-id}}