dyn_cast -> dyn_cast_or_null to handle a null pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216254
91177308-0d34-0410-b5e6-
96231b3b80d8
// Static locals inherit dll attributes from their function.
if (VD->isStaticLocal()) {
if (FunctionDecl *FD =
- dyn_cast<FunctionDecl>(VD->getParentFunctionOrMethod())) {
+ dyn_cast_or_null<FunctionDecl>(VD->getParentFunctionOrMethod())) {
if (Attr *A = getDLLAttr(FD)) {
auto *NewAttr = cast<InheritableAttr>(A->clone(getASTContext()));
NewAttr->setInherited(true);
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+template <typename T>
+struct X {};
+auto b = []() {
+ struct S {
+ static typename X<decltype(int)>::type Run(){};
+ // expected-error@-1 4{{}}
+ };
+ return 5;
+}();
+
+template <typename T1, typename T2>
+class PC {
+};
+
+template <typename T>
+class P {
+ static typename PC<T, Invalid>::Type Foo();
+ // expected-error@-1 4{{}}
+};