[PATCH] D11341: [SemaTemplate] Detect instantiation of unparsed exceptions
Davide Italiano
dccitaliano at gmail.com
Fri Jul 24 18:20:04 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL243196: [SemaTemplate] Detect instantiation of unparsed exceptions. (authored by davide).
Changed prior to commit:
http://reviews.llvm.org/D11341?vs=30120&id=30627#toc
Repository:
rL LLVM
http://reviews.llvm.org/D11341
Files:
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/SemaTemplate/crash-unparsed-exception.cpp
Index: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
@@ -161,7 +161,13 @@
else
InstantiateExceptionSpec(Loc, SourceDecl);
- return SourceDecl->getType()->castAs<FunctionProtoType>();
+ const FunctionProtoType *Proto =
+ SourceDecl->getType()->castAs<FunctionProtoType>();
+ if (Proto->getExceptionSpecType() == clang::EST_Unparsed) {
+ Diag(Loc, diag::err_exception_spec_not_parsed);
+ Proto = nullptr;
+ }
+ return Proto;
}
void
Index: cfe/trunk/test/SemaTemplate/crash-unparsed-exception.cpp
===================================================================
--- cfe/trunk/test/SemaTemplate/crash-unparsed-exception.cpp
+++ cfe/trunk/test/SemaTemplate/crash-unparsed-exception.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -fcxx-exceptions -fexceptions %s
+
+struct A {
+ virtual ~A();
+};
+template <class>
+struct B {};
+struct C {
+ template <typename>
+ struct D {
+ ~D() throw();
+ };
+ struct E : A {
+ D<int> d; //expected-error{{exception specification is not available until end of class definition}}
+ };
+ B<int> b; //expected-note{{in instantiation of template class 'B<int>' requested here}}
+};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11341.30627.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150725/a713a2de/attachment.bin>
More information about the cfe-commits
mailing list