r341869 - [AST] Fix a crash on invalid.
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 10 14:54:04 PDT 2018
Author: epilk
Date: Mon Sep 10 14:54:04 2018
New Revision: 341869
URL: http://llvm.org/viewvc/llvm-project?rev=341869&view=rev
Log:
[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
Added:
cfe/trunk/test/SemaCXX/rdar42746401.cpp
Modified:
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=341869&r1=341868&r2=341869&view=diff
==============================================================================
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Mon Sep 10 14:54:04 2018
@@ -547,6 +547,7 @@ operator=(const NestedNameSpecifierLocBu
}
// Deep copy.
+ BufferSize = 0;
Append(Other.Buffer, Other.Buffer + Other.BufferSize, Buffer, BufferSize,
BufferCapacity);
return *this;
Added: cfe/trunk/test/SemaCXX/rdar42746401.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/rdar42746401.cpp?rev=341869&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/rdar42746401.cpp (added)
+++ cfe/trunk/test/SemaCXX/rdar42746401.cpp Mon Sep 10 14:54:04 2018
@@ -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}}
More information about the cfe-commits
mailing list