[PATCH] D48880: [Sema] Fix crash in getConstructorName.
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 4 01:37:44 PDT 2018
ilya-biryukov updated this revision to Diff 154063.
ilya-biryukov marked an inline comment as done.
ilya-biryukov added a comment.
- Better recovery for invalid decls that do have an injected class name
- Move the test to SemaCXX
Repository:
rC Clang
https://reviews.llvm.org/D48880
Files:
lib/Sema/SemaExprCXX.cpp
test/SemaCXX/injected-class-name-crash.cpp
Index: test/SemaCXX/injected-class-name-crash.cpp
===================================================================
--- /dev/null
+++ test/SemaCXX/injected-class-name-crash.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <class T>
+struct X : public Foo<Bar { // expected-error {{unknown template name 'Foo'}} expected-error {{use of undeclared identifier 'Bar'}}
+ X();
+}; // expected-error {{expected '{' after base class list}}
+
+
+template <class T>
+X<T>::X() {
+}
Index: lib/Sema/SemaExprCXX.cpp
===================================================================
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -113,6 +113,8 @@
break;
}
}
+ if (!InjectedClassName && CurClass->isInvalidDecl())
+ return ParsedType();
assert(InjectedClassName && "couldn't find injected class name");
QualType T = Context.getTypeDeclType(InjectedClassName);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48880.154063.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180704/31db893a/attachment.bin>
More information about the cfe-commits
mailing list